Submission #209081

#TimeUsernameProblemLanguageResultExecution timeMemory
209081MertD014Nizin (COCI16_nizin)C++17
0 / 100
5 ms376 KiB
#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)

nizin.cpp: In function 'int main()':
nizin.cpp:8:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("all.in","r",stdin);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~
nizin.cpp:9:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("all.out","w",stdout);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#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...