Submission #83598

#TimeUsernameProblemLanguageResultExecution timeMemory
83598luciocfNizin (COCI16_nizin)C++14
100 / 100
208 ms4540 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e6+10; int num[maxn]; int main(void) { int n; cin >> n; for (int i = 1; i <= n; i++) cin >> num[i]; int l = 1, r = n, ans = 0; ll somal = num[1], somar = num[n]; while (true) { if (l >= r) break; if (somal < somar) somal += (ll)num[++l], ans++; else if (somar < somal) somar += (ll)num[--r], ans++; else somal = num[++l], somar = num[--r]; } cout << ans << "\n"; }
#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...