Submission #968687

#TimeUsernameProblemLanguageResultExecution timeMemory
968687RandomUserNizin (COCI16_nizin)C++17
100 / 100
116 ms10160 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; int main() { int n; cin >> n; vector<ll> v(n); for(ll &x : v) cin >> x; int i=0, j=n-1; int ans = 0; while(i < j) { if(v[i] == v[j]) { i++, j--; continue; } ans++; if(v[i] < v[j]) v[i+1] += v[i], i++; else v[j-1] += v[j], j--; } cout << ans << '\n'; 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...