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;
int n;
int a[1000000];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
unsigned long long curr=0,prev=a[0];
int br=1;
for(int i=1;i<n;i++)
{
curr+=a[i];
if(curr>=prev)
{
prev=curr;
curr=0;
br++;
}
}
curr=0,prev=a[0]+a[1];
int br2=1;
for(int i=2;i<n;i++)
{
curr+=a[i];
if(curr>=prev)
{
prev=curr;
curr=0;
br2++;
}
}
br=max(br,br2);
printf("%d\n",br);
}
# | 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... |