# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
631527 | 2022-08-18T08:11:46 Z | berr | Nizin (COCI16_nizin) | C++17 | 58 ms | 18336 KB |
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin>>n; vector<int> a(n); int sum=0; for(int i=0; i<n; i++) { cin>>a[i]; sum+=a[i]; } vector<int> x, y; int l=0; int flag=0, pos=0; for(int i=0; i<n; i++) { l+=a[i]; if(l==sum/2) { pos=i; flag=1; } } if(flag==0) { l=0; for(int i=0; i<n-1; i++) { if((sum-a[i])/2==l) { pos=i; } } for(int i=0; i<n; i++) { if(i<pos) x.push_back(a[i]); if(i>pos) y.push_back(a[i]); } reverse(y.begin(), y.end()); } else { for(int i=0; i<n; i++) { if(i<=pos) x.push_back(a[i]); else y.push_back(a[i]); } reverse(y.begin(), y.end()); } l=0; int r=0; int s=0; while(l<x.size()&&r<y.size()) { if(x[l]==y[r]) l++, r++; else if(x[l]<y[r]) { x[l+1]+=x[l]; s++; l++; } else { y[r+1]+=y[r]; s++; r++; } } cout<<s; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 320 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 2204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 7864 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 47 ms | 16076 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 58 ms | 18336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |