Submission #658595

#TimeUsernameProblemLanguageResultExecution timeMemory
658595pere_gilRarest Insects (IOI22_insects)C++17
0 / 100
1 ms208 KiB
#include "insects.h" #include "bits/stdc++.h" using namespace std; void pri(queue<int> q){ printf(": "); while(!q.empty()){ printf("%d ",q.front()); q.pop(); } printf("\n"); } queue<int> get(queue<int> &q){ queue<int> in,out; while(!q.empty()){ int u=q.front(); q.pop(); move_inside(u); if(press_button()==1) in.push(u); else{ out.push(u); move_outside(u); } } while(!in.empty()){ move_outside(in.front()); in.pop(); } return out; } int min_cardinality(int n) { queue<int> q; for(int i=0;i<n;i++) q.push(i); q=get(q); int prev=q.size(); int res; for(res=1;res<n;res++){ q=get(q); if(prev!=q.size()) break; prev=q.size(); } return res; }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:41:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::queue<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |   if(prev!=q.size()) break;
      |      ~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...