Submission #170317

#TimeUsernameProblemLanguageResultExecution timeMemory
170317ngmhNizin (COCI16_nizin)C++11
100 / 100
272 ms10272 KiB
#include <bits/stdc++.h> using namespace std; long long n, a[1000000], s, e, o; int main(){ cin >> n; for(int i = 0; i < n; i++) cin >> a[i]; e = n-1; while(s != e && s < e){ if(a[s] == a[e]){ s++; e--; } else if(a[s] < a[e]){ a[s+1] += a[s]; s++; o++; } else { a[e-1] += a[e]; e--; o++; } } cout << o; }
#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...