# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
341574 | 2020-12-30T04:55:04 Z | katearima | Bigger segments (IZhO19_segments) | C++14 | 0 ms | 364 KB |
#include <bits/stdc++.h> using namespace std; const int N=500005; int a[N], oldS, n, sum, ans; main(){ cin>>n; for(int i=0; i<n; i++){ cin>>a[i]; } //sums[0]=a[0]; /*for(int i=1; i<n; i++){ sums[i]=sums[i-1]+a[i]; }*/ oldS=a[0]; ans=1; for(int i=1; i<n; i++){ int t=i; sum=0; while(sum<oldS && i<n){ sum+=a[i]; i++; } i--; /*while(oldS+a[t]<= sum-a[t]){ oldS+=a[t]; sum-=a[t]; t++; }*/ if(sum>=oldS) ans++; oldS=sum; //cout<<i<<" "<<a[i]<<endl; } cout<<ans<<endl; } /* I wanna win a medal in IZHO If you watch shingeki no kyojin you can take my code */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Incorrect | 0 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Incorrect | 0 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Incorrect | 0 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Incorrect | 0 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Incorrect | 0 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |