# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
43361 | 2018-03-14T18:01:27 Z | Hassoony | Nizin (COCI16_nizin) | C++14 | 103 ms | 4420 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int MX=1e6+9; int n,a[MX]; int main(){ scanf("%d",&n); for(int i=0;i<n;i++)scanf("%d",&a[i]); int p1=0,p2=n-1,ans=0; ll sum=0; while(p1<p2){ if(sum+a[p1]-a[p2]==0){ ++p1; --p2; sum=0; continue; } if(sum+a[p1]<sum-a[p2]){ sum+=a[p1++]; ans++; } else{ sum-=a[p2--]; ans++; } } if(n==1){ cout<<0<<endl; return 0; } if(sum!=0)ans++; cout<<ans<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 1 ms | 480 KB | Output is correct |
3 | Incorrect | 1 ms | 480 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 480 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 480 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 480 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 496 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 496 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 928 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 35 ms | 1828 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 77 ms | 3524 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 103 ms | 4420 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |