Submission #510255

#TimeUsernameProblemLanguageResultExecution timeMemory
510255salamhassanNizin (COCI16_nizin)C++14
0 / 100
1094 ms8308 KiB
#include <bits/stdc++.h> using namespace std; int a[1000007],n,l,r,ans; int main() { cin>>n; for (int i=0; i<n; i++) { cin>>a[i]; } l=0; r=n-1; while (l<n) { if (a[l]==a[r]) { l++; r--; } while (r>0 && a[l]!=a[r]) { if (a[l]>a[r]) { a[r-1]+=a[r]; r--; ans++; } else { a[l+1]+=a[l]; l++; ans++; } } } cout<<ans; 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...