AtCoder Grand Contest 004

Submission #1358110

Source codeソースコード

// Copyright 2017 wu_qing
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdint>
const int N = 2e3 + 10;
int n;
int64_t tot, ans = ~0ull >> 1, x, a[N], b[N];
int main() {
    memset(b, 127, sizeof b);
    scanf("%d%lld", &n, &x);
    for (int i = 0; i < n; i++)
        scanf("%lld", a + i);
    for (int i = 0; i < n; i++) {
        tot = i * x;
        for (int j = 0; j < n; j++)
            tot += (b[j] = std::min(b[j], a[(j - i + n) % n]));
        ans = std::min(ans, tot);
    }
    printf("%lld\n", ans);
    return 0;
}

Submission

Task問題 B - Colorful Slimes
User nameユーザ名 wu_qing
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 400
Source lengthソースコード長 574 Byte
File nameファイル名
Exec time実行時間 15 ms
Memory usageメモリ使用量 128 KB

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:27: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 3 has type ‘int64_t* {aka long int*}’ [-Wformat=]
scanf("%d%lld", &n, &x);
^
./Main.cpp:13:28: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘int64_t* {aka long int*}’ [-Wformat=]
scanf("%lld", a + i);
^
./Main.cpp:20:25: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int64_t {aka long int}’ [-Wformat=]
printf("%lld\n", ans);
^
./Main.cpp:11:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%lld", &n, &x);
^
./Main.cpp:13:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld"...

Test case

Set

Set name Score得点 / Max score Cases
Sample - 0_00.txt,0_01.txt,0_02.txt
All 400 / 400 0_00.txt,0_01.txt,0_02.txt,1_00.txt,1_01.txt,1_02.txt,1_03.txt,1_04.txt,1_05.txt,1_06.txt,1_07.txt,1_08.txt,1_09.txt,1_10.txt,1_11.txt,1_12.txt,1_13.txt,1_14.txt,1_15.txt,1_16.txt,1_17.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
0_00.txt AC
0_01.txt AC 1 ms 128 KB
0_02.txt AC 1 ms 128 KB
1_00.txt AC 15 ms 128 KB
1_01.txt AC 15 ms 128 KB
1_02.txt AC 15 ms 128 KB
1_03.txt AC 15 ms 128 KB
1_04.txt AC 15 ms 128 KB
1_05.txt AC 15 ms 128 KB
1_06.txt AC 15 ms 128 KB
1_07.txt AC 15 ms 128 KB
1_08.txt AC 15 ms 128 KB
1_09.txt AC 15 ms 128 KB
1_10.txt AC 11 ms 128 KB
1_11.txt AC 15 ms 128 KB
1_12.txt AC 14 ms 128 KB
1_13.txt AC 10 ms 128 KB
1_14.txt AC 15 ms 128 KB
1_15.txt AC 12 ms 128 KB
1_16.txt AC 13 ms 128 KB
1_17.txt AC 15 ms 128 KB