Submission #164622

#TimeUsernameProblemLanguageResultExecution timeMemory
164622_qVp_Nizin (COCI16_nizin)C++14
0 / 100
83 ms6392 KiB
#include <bits/stdc++.h> using namespace std; const int md = 1e6 + 10; int a[md]; int n; int main() { //freopen("test.in", "r", stdin); ios_base::sync_with_stdio(0); cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; int l = 1, r = n, vL = a[1], vR = a[n], cnt = 0; while (l <= r) { if (vL == vR) { vL = a[++l]; vR = a[--r]; } else if (vL < vR) { cnt++; vL += a[++l]; } else { cnt++; vR += a[--r]; } } cout << cnt; 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...