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 ll long long
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false)
#define inf LLONG_MAX
int main(){
fastio;
int n;
cin>>n;
ll a[n+1];
for(int i=1;i<=n;i++){
cin>>a[i];
}
ll ans=1,tot=0;
for(int i=1;i<=n;i++){
tot+=a[i];
ll cnt=1,sum=tot,sum2=0;
for(int j=i+1;j<=n;j++){
sum2+=a[j];
if(sum2>=sum){
cnt++;
sum=sum2;
sum2=0;
}
}
ans=max(ans,cnt);
}
cout<<ans<<endl;
return 0;
}
# | 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... |