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;
typedef long long ll;
int main() {
int n;
cin>>n;
vector<int>a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
ll sum=0;
int ans=1;
for(int i=0;i<n;i++){
sum+=a[i];
int cur=1;
ll cur_sum=0;
ll prev_sum=sum;
for(int j=i+1;j<n;j++){
cur_sum+=a[j];
if(cur_sum>=prev_sum){
prev_sum=cur_sum;
cur_sum=0;
cur++;
}
}
if(cur_sum==0)ans=max(ans,cur);
}
cout<<ans;
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... |