# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
341581 | katearima | Bigger segments (IZhO19_segments) | C++14 | 1 ms | 364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
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];
}
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] && t<i){
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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |