Submission #658598

#TimeUsernameProblemLanguageResultExecution timeMemory
658598pere_gilRarest Insects (IOI22_insects)C++17
10 / 100
361 ms304 KiB
#include "insects.h" #include "bits/stdc++.h" using namespace std; void pri(vector<int> v){ for(int x: v) printf("%d ",x); printf("\n"); } void get(vector<int> &u, vector<int> &r){ vector<int> unique; for(int x: u){ move_inside(x); if(press_button()==2){ move_outside(x); r.push_back(x); } else unique.push_back(x); } for(int x: unique) move_outside(x); u=unique; } int min_cardinality(int n) { vector<int> u(n),r; iota(u.begin(),u.end(),0); get(u,r); int prev=u.size(); u=r; r.clear(); int res=1; for(;res<n;res++){ get(u,r); if(u.size()<prev) break; prev=u.size(); u=r; r.clear(); } return res; }

Compilation message (stderr)

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