Submission #726094

#TimeUsernameProblemLanguageResultExecution timeMemory
726094TheSahibRarest Insects (IOI22_insects)C++17
10 / 100
390 ms308 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; int min_cardinality(int N) { vector<int> types; vector<int> left; for (int i = 0; i < N; i++) { move_inside(i); if(press_button() > 1){ left.push_back(i); move_outside(i); } else{ types.push_back(i); } } if(types.size() == 1) return N; for (int i = 2; i <= N / types.size() + 1; i++) { vector<int> tmp; for(int a:left){ move_inside(a); if(press_button() > i){ move_outside(a); tmp.push_back(a); } } if(N - tmp.size() < types.size() * i){ return i - 1; } left = tmp; } return N; }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:22:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for (int i = 2; i <= N / types.size() + 1; i++)
      |                     ~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...