# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
912462 |
2024-01-19T14:07:43 Z |
Neos |
Nizin (COCI16_nizin) |
C++14 |
|
49 ms |
6264 KB |
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int n, a[N];
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
int l = 1, r = n, cnt = 0;
for (; l < r; ) {
if (a[l] == a[r]) {
l++;
r--; // (l + 1, r - 1)
}
else {
if (a[l] > a[r]) {
a[r - 1] += a[r];
r--; // (l, r - 1)
cnt++;
}
else {
a[l + 1] += a[l];
l++; // (l + 1, r - 1)
cnt++;
}
}
}
cout << cnt;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
348 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 |
0 ms |
348 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 |
1 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 |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 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 |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
472 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
2784 KB |
Output is correct |
2 |
Correct |
5 ms |
2652 KB |
Output is correct |
3 |
Correct |
5 ms |
2656 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
3164 KB |
Output is correct |
2 |
Correct |
20 ms |
3424 KB |
Output is correct |
3 |
Correct |
22 ms |
3580 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
4992 KB |
Output is correct |
2 |
Correct |
35 ms |
4976 KB |
Output is correct |
3 |
Correct |
41 ms |
5716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
6120 KB |
Output is correct |
2 |
Correct |
44 ms |
6264 KB |
Output is correct |
3 |
Correct |
49 ms |
6228 KB |
Output is correct |