Submission #510071

#TimeUsernameProblemLanguageResultExecution timeMemory
510071Jean7Nizin (COCI16_nizin)C++14
0 / 100
62 ms17236 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() ) { 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...