제출 #936597

#제출 시각아이디문제언어결과실행 시간메모리
936597AiperiiiBigger segments (IZhO19_segments)C++14
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() using namespace std; signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); int n; cin>>n; vector <int> a(n); for(int i=0;i<n;i++)cin>>a[i]; int mx=0; for(int i=0;i<n;i++){ int sum1=0,cnt=1,sum=0; for(int j=0;j<=i;j++)sum1+=a[j]; for(int j=i+1;j<n;j++){ sum+=a[j]; if(sum>=sum1){ cnt++;sum=0; } } if(sum==0)mx=max(mx,cnt); } cout<<mx<<"\n"; } /* 4 2 3 1 7 5 6 2 3 9 13 3 3 1 2 */
#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...