Submission #226174

#TimeUsernameProblemLanguageResultExecution timeMemory
226174osaaateiasavtnlNizin (COCI16_nizin)C++14
100 / 100
69 ms10236 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define ii pair <int, int> #define app push_back #define all(a) a.begin(), a.end() #define bp __builtin_popcount #define ll long long #define mp make_pair #define f first #define s second #define Time (double)clock()/CLOCKS_PER_SEC const int N = 1e6 + 7; int a[N]; signed main() { #ifdef HOME freopen("input.txt", "r", stdin); #else #define endl '\n' ios_base::sync_with_stdio(0); cin.tie(0); #endif int n; cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; } int l = -1, r = n; int seg = 0; while (l < r - 1) { int suml = 0, sumr = 0; while (l < r - 1) { if (suml < sumr) { ++l; suml += a[l]; } else { --r; sumr += a[r]; } if (suml == sumr) break; } if (suml == sumr) { seg += 2; } else { seg += 1; break; } } cout << n - seg << endl; }
#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...