Submission #1358101


Source Code Expand

// Copyright 2017 wu_qing
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdint>
const int N = 2e3 + 10;
int n, a[N], b[N], x;
int64_t tot, ans = ~0ull >> 1;
int main() {
    memset(b, 127, sizeof b);
    scanf("%d%d", &n, &x);
    for (int i = 0; i < n; i++)
        scanf("%d", 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 Info

Submission Time
Task B - Colorful Slimes
User wu_qing
Language C++14 (GCC 5.4.1)
Score 0
Code Size 570 Byte
Status WA
Exec Time 15 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./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:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &x);
                          ^
./Main.cpp:13:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", a + i);
                           ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 9
WA × 12
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt
All 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
Case Name Status Exec Time Memory
0_00.txt AC 1 ms 128 KB
0_01.txt AC 1 ms 128 KB
0_02.txt AC 1 ms 128 KB
1_00.txt AC 15 ms 256 KB
1_01.txt WA 15 ms 128 KB
1_02.txt AC 15 ms 128 KB
1_03.txt WA 15 ms 128 KB
1_04.txt WA 15 ms 128 KB
1_05.txt WA 15 ms 128 KB
1_06.txt WA 15 ms 128 KB
1_07.txt WA 15 ms 128 KB
1_08.txt WA 15 ms 128 KB
1_09.txt WA 15 ms 128 KB
1_10.txt AC 11 ms 128 KB
1_11.txt AC 15 ms 128 KB
1_12.txt WA 14 ms 128 KB
1_13.txt WA 10 ms 128 KB
1_14.txt WA 15 ms 128 KB
1_15.txt AC 12 ms 128 KB
1_16.txt WA 13 ms 128 KB
1_17.txt AC 15 ms 128 KB