# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
242534 |
2020-06-28T06:40:23 Z |
VEGAnn |
Nizin (COCI16_nizin) |
C++14 |
|
68 ms |
4216 KB |
#include <bits/stdc++.h>
using namespace std;
const int N = 1000100;
int ans = 0, a[N], n;
bool ed = 0;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int lf = 0, rt = n - 1;
while (!ed){
while (a[lf] != a[rt]){
if (lf + 1 == rt){
ans++;
ed = 1;
break;
}
if (a[lf] < a[rt]){
a[lf + 1] += a[lf];
lf++;
ans++;
} else {
a[rt - 1] += a[rt];
rt--;
ans++;
}
}
if (lf + 1 >= rt - 1)
ed = 1;
else {
lf++;
rt--;
}
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 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 |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 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 |
9 ms |
640 KB |
Output is correct |
2 |
Correct |
11 ms |
768 KB |
Output is correct |
3 |
Correct |
16 ms |
768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1656 KB |
Output is correct |
2 |
Correct |
35 ms |
2040 KB |
Output is correct |
3 |
Correct |
37 ms |
2296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
3320 KB |
Output is correct |
2 |
Correct |
57 ms |
3448 KB |
Output is correct |
3 |
Correct |
59 ms |
3832 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
68 ms |
4216 KB |
Output is correct |
2 |
Correct |
65 ms |
4216 KB |
Output is correct |
3 |
Correct |
68 ms |
4216 KB |
Output is correct |