# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
875442 | 2023-11-19T17:14:31 Z | Tien_Noob | Nizin (COCI16_nizin) | C++17 | 43 ms | 10224 KB |
//Make CSP great again //Vengeance #include <bits/stdc++.h> #define TASK "TESTCODE" using namespace std; const int N = 1e6; long long a[N + 1]; int n; void read() { cin >> n; for (int i = 1; i <= n; ++ i) { cin >> a[i]; } } void solve() { int l = 1, r = n, res = 0; while(l < r) { if (a[l] == a[r]) { ++l; --r; } else if (a[l] < a[r]) { a[l + 1] += a[l]; ++l; ++res; } else { a[r - 1] += a[r]; --r; ++res; } } cout << res; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); if (fopen(TASK".INP", "r")) { freopen(TASK".INP", "r", stdin); //freopen(TASK".OUT", "w", stdout); } int t = 1; bool typetest = false; if (typetest) { cin >> t; } for (int __ = 1; __ <= t; ++ __) { //cout << "Case " << __ << ": "; read(); solve(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 600 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 468 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2652 KB | Output is correct |
2 | Correct | 5 ms | 2652 KB | Output is correct |
3 | Correct | 5 ms | 2648 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 5212 KB | Output is correct |
2 | Correct | 18 ms | 5496 KB | Output is correct |
3 | Correct | 22 ms | 5756 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 32 ms | 8284 KB | Output is correct |
2 | Correct | 34 ms | 8284 KB | Output is correct |
3 | Correct | 39 ms | 9208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 10068 KB | Output is correct |
2 | Correct | 43 ms | 10224 KB | Output is correct |
3 | Correct | 43 ms | 10108 KB | Output is correct |