Submission #510073

#TimeUsernameProblemLanguageResultExecution timeMemory
510073Jean7Nizin (COCI16_nizin)C++14
100 / 100
74 ms8832 KiB
#include <bits/stdc++.h> #define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define int long long using namespace std ; deque <int> d ; int32_t main () { fastio int n , x , ans = 0 ; cin >> n ; for ( int i = 0 ; i < n; i++ ) { cin >> x ; d.push_back(x) ; } int j ; while ( !d.empty() && d.size() > 1 ) { if ( d.front() < d.back() ) { j = d.front() ; d.pop_front() ; d.front() += j ; ans++ ; } else if ( d.front() > d.back() ) { j = d.back() ; d.pop_back() ; d.back() += j ; ans++ ; } else if ( d.front() == d.back() ) { d.pop_back() ; d.pop_front() ; } } 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...