# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
209081 | MertD014 | Nizin (COCI16_nizin) | C++17 | 5 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
deque<int> dq;
int n,x,ans;
int main(){
freopen("all.in","r",stdin);
freopen("all.out","w",stdout);
cin>>n;
for(int i=0;i<n;i++){
cin>>x;
dq.push_back(x);
}
while(dq.size()>=2){
if(dq.front()==dq.back()){
//cout<<"=";
dq.pop_back();
dq.pop_front();
}
else if(dq.front()<dq.back()){
//cout<<"<";
x=dq.front();
dq.pop_front();
dq.front()+=x;
ans++;
}
else if(dq.front()>dq.back()){
//cout<<">";
x=dq.back();
dq.pop_back();
dq.back()+=x;
ans++;
}
}
cout<<ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |