# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
242531 |
2020-06-28T06:31:08 Z |
NONAME |
Nizin (COCI16_nizin) |
C++14 |
|
83 ms |
6392 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int N = 1e6 + 500;
int n, ans, a[N];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 0; i < n; ++i)
cin >> a[i];
int l = 0, r = n - 1;
while (l < r) {
if (a[l] == a[r]) {
++l, --r;
continue;
}
if (a[l] < a[r]) {
a[l + 1] += a[l];
++l;
++ans;
} else {
a[r - 1] += a[r];
--r;
++ans;
}
}
cout << ans << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
304 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
768 KB |
Output is correct |
2 |
Correct |
11 ms |
896 KB |
Output is correct |
3 |
Correct |
12 ms |
896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
2424 KB |
Output is correct |
2 |
Correct |
39 ms |
2936 KB |
Output is correct |
3 |
Correct |
36 ms |
3456 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
55 ms |
4856 KB |
Output is correct |
2 |
Correct |
52 ms |
5116 KB |
Output is correct |
3 |
Correct |
62 ms |
5764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
83 ms |
6264 KB |
Output is correct |
2 |
Correct |
67 ms |
6392 KB |
Output is correct |
3 |
Correct |
74 ms |
6376 KB |
Output is correct |