Submission #209109

#TimeUsernameProblemLanguageResultExecution timeMemory
209109DysonSphereNizin (COCI16_nizin)C++14
100 / 100
228 ms5496 KiB
#include<bits/stdc++.h> using namespace std; deque<int> q; int ans; int main(){ //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); int n,temp; cin>>n; for(int i=0;i<n;i++){ cin>>temp; q.push_back(temp); } while(q.size()>1){ if(q.front()==q.back()){ q.pop_front(); q.pop_back(); } else{ ans++; if(q.front()>q.back()){ int now=q.back(); q.pop_back(); now+=q.back(); q.pop_back(); q.push_back(now); } else{ int now=q.front(); q.pop_front(); now+=q.front(); q.pop_front(); q.push_front(now); } } } 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...