Submission #893109

#TimeUsernameProblemLanguageResultExecution timeMemory
893109Trisanu_DasRarest Insects (IOI22_insects)C++17
50 / 100
108 ms1352 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; int min_cardinality(int N) { vector<int> in; for (int i = 0; i < N; i++) { in.push_back(i); move_inside(i); if (press_button() >= 2) { in.pop_back(); move_outside(i); } } int diff = in.size(); if (diff == 1) return N; function<bool(int)> check = [&](int x) { for (int i : in) move_outside(i); in.clear(); for (int i = 0; i < N; i++) { in.push_back(i); move_inside(i); if (press_button() > x) { in.pop_back(); move_outside(i); } } return in.size() == x * diff; }; int l = 1, r = N / diff; while (l <= r){ int m = (l + r) >> 1; if (check(m)) l = m + 1; else r = m - 1; } return r; }

Compilation message (stderr)

insects.cpp: In lambda function:
insects.cpp:28:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |         return in.size() == x * diff;
      |                ~~~~~~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...