# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
545401 | krit3379 | Bigger segments (IZhO19_segments) | C++17 | 1 ms | 316 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>
using namespace std;
#define N 500005
int ans;
long long a[N],now,pos,val;
int main(){
int n,i;
scanf("%d",&n);
for(i=1;i<=n;i++)scanf("%lld",&a[i]),a[i]+=a[i-1];
now=0;
val=0;
while(now<n){
ans++;
pos=lower_bound(a+1,a+n+1,a[now]+val)-a;
val=a[pos]-a[now];
now=pos;
}
printf("%d",ans);
return 0;
}
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... |