Submission #524144

#TimeUsernameProblemLanguageResultExecution timeMemory
524144inluminasBigger segments (IZhO19_segments)C++17
0 / 100
1 ms204 KiB
#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 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...