Submission #742640

#TimeUsernameProblemLanguageResultExecution timeMemory
742640dooweyRarest Insects (IOI22_insects)C++17
0 / 100
219 ms452 KiB
#include <bits/stdc++.h> #include "insects.h" using namespace std; typedef pair<int, int> pii; #define fi first #define se second #define mp make_pair int min_cardinality(int n) { int val; vector<int> in; for(int i = 0 ; i < n; i ++ ){ move_inside(i); val = press_button(); if(val > 1){ move_outside(i); } else{ in.push_back(i); } } int dist = in.size(); int l = 1; int r = n + 1; int mid; while(l + 1 < r){ mid = (l + r) / 2; for(auto x : in){ move_outside(x); } in.clear(); for(int i = 0 ; i < n; i ++ ){ move_inside(i); val = press_button(); if(val > mid){ move_outside(i); } else{ in.push_back(i); } } if(in.size() == mid * dist){ l = mid; } else{ r = mid - 1; } } return l; }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:45:22: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   45 |         if(in.size() == mid * dist){
      |            ~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...