Submission #726314

#TimeUsernameProblemLanguageResultExecution timeMemory
726314ismayilRarest Insects (IOI22_insects)C++17
0 / 100
2 ms464 KiB
#pragma GCC optimize("O3") #include "insects.h" #include <bits/stdc++.h> using namespace std; int min_cardinality(int N) { vector<int> in; for(int j = 0; j < N; j++){ move_inside(j); if(press_button() > 1){ move_outside(j); }else{ in.push_back(j); } } int D = in.size(); while(!in.empty()) move_outside(in.back()), in.pop_back(); for(int i = 2; i <= N; i++){ vector<int> in; for(int j = 0; j < N; j++){ move_inside(j); if(press_button() > i){ move_outside(j); }else{ in.push_back(j); } } if(in.size() < i * D){ return i - 1; } while(!in.empty()) move_outside(in.back()), in.pop_back(); } }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:28:16: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |   if(in.size() < i * D){
      |      ~~~~~~~~~~^~~~~~~
insects.cpp:7:14: warning: control reaches end of non-void function [-Wreturn-type]
    7 |  vector<int> in;
      |              ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...