제출 #882744

#제출 시각아이디문제언어결과실행 시간메모리
882744kokoueBigger segments (IZhO19_segments)C++14
0 / 100
1 ms500 KiB
#include<bits/stdc++.h> using namespace std; int n; int a[1000000]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin>>n; for(int i=0;i<n;i++) { cin>>a[i]; } unsigned long long curr=0,prev=a[0]; int br=1; for(int i=1;i<n;i++) { curr+=a[i]; if(curr>=prev) { prev=curr; curr=0; br++; } } curr=0,prev=a[0]+a[1]; int br2=1; for(int i=2;i<n;i++) { curr+=a[i]; if(curr>=prev) { prev=curr; curr=0; br2++; } } br=max(br,br2); printf("%d\n",br); }
#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...