제출 #887110

#제출 시각아이디문제언어결과실행 시간메모리
887110Hovhannes1234Bigger segments (IZhO19_segments)C++17
0 / 100
1 ms604 KiB
#include <bits/stdc++.h> using namespace std; const int N = 3050; long long a[N], pref[N]; int main() { long long n; cin>>n; for(int i=1; i<=n; i++){ cin>>a[i]; } pref[1]=a[1]; for(int i=2; i<=n; i++){ pref[i]=pref[i-1]+a[i]; } long long ans=1, s=0, k=0; vector <long long> vec; for(int j=1; j<=n; j++){ s=pref[j]; ans=1; k=0; for(int i=j+1; i<=n; i++){ k+=a[i]; if(k >= s){ ans++; s=k; k=0; } } vec.push_back(ans); } sort(vec.begin(), vec.end()); cout<<vec[(long long)vec.size()-1]; }
#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...