Submission #443162

#TimeUsernameProblemLanguageResultExecution timeMemory
443162penguinhackerNizin (COCI16_nizin)C++14
100 / 100
87 ms10520 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array int main() { ios::sync_with_stdio(0); cin.tie(0); int n, ans=0; cin >> n; deque<ll> a(n); for (ll& i : a) cin >> i; while(a.size()>1) { if (a[0]==a.back()) { a.pop_front(); a.pop_back(); } else if (a[0]<a.back()) { a[1]+=a[0]; a.pop_front(); ++ans; } else { a.end()[-2]+=a.back(); a.pop_back(); ++ans; } } cout << ans; 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...