Submission #798681

#TimeUsernameProblemLanguageResultExecution timeMemory
798681raphaelpNizin (COCI16_nizin)C++14
100 / 100
109 ms10184 KiB
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long long> tab(N); for (int i = 0; i < N; i++) { cin >> tab[i]; } int a = 0, b = N - 1; int tot = 0; while (a < b) { if (tab[a] == tab[b]) { a++; b--; } else if (tab[a] > tab[b]) { tab[b - 1] += tab[b]; b--; tot++; } else { tab[a + 1] += tab[a]; a++; tot++; } } cout << tot; }
#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...