Submission #720680

#TimeUsernameProblemLanguageResultExecution timeMemory
720680Yell0Nizin (COCI16_nizin)C++17
100 / 100
57 ms10184 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MN=1e6+2; ll N,A[MN],ans=0; int main() { ios::sync_with_stdio(0);cin.tie(0); cin>>N; for(int i=1;i<=N;i++) cin>>A[i]; int l=1,r=N; while(r>l) { if(A[l]>A[r]) { ans++; A[r-1]+=A[r]; r--; } else if(A[l]<A[r]) { ans++; A[l+1]+=A[l]; l++; } else { l++;r--; } } cout<<ans<<'\n'; 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...
#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...