# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
201179 | 2020-02-09T15:42:53 Z | SamAnd | Nizin (COCI16_nizin) | C++17 | 124 ms | 6416 KB |
#include <bits/stdc++.h> using namespace std; const int N = 1000006; int n; int a[N]; int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d", &a[i]); } int s = 0; int l = 0, r = n + 1; long long suml = 0, sumr = 0; while (1) { if (l > r) break; if (l == r) { ++s; break; } if (suml < sumr) { ++l; suml += a[l]; } else if (suml > sumr) { --r; sumr += a[r]; } else { s += 2; ++l; --r; suml += a[l]; sumr += a[r]; } } s -= 2; printf("%d\n", n - s); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 6 ms | 456 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 7 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 760 KB | Output is correct |
2 | Correct | 16 ms | 888 KB | Output is correct |
3 | Correct | 17 ms | 888 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 2428 KB | Output is correct |
2 | Correct | 53 ms | 2820 KB | Output is correct |
3 | Correct | 60 ms | 3252 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 98 ms | 4856 KB | Output is correct |
2 | Correct | 95 ms | 5120 KB | Output is correct |
3 | Correct | 107 ms | 5624 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 124 ms | 6136 KB | Output is correct |
2 | Correct | 117 ms | 6416 KB | Output is correct |
3 | Correct | 121 ms | 6240 KB | Output is correct |