Submission #172688

#TimeUsernameProblemLanguageResultExecution timeMemory
172688LinusTorvaldsFanBigger segments (IZhO19_segments)C++14
0 / 100
2 ms380 KiB
#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++; } } ans=max(ans,cur); } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...