Submission #1232430

#TimeUsernameProblemLanguageResultExecution timeMemory
1232430badge881Rarest Insects (IOI22_insects)C++20
0 / 100
0 ms408 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; int n; int posOfKFirstOf(int K) { int res = 0; vector<int> in; for (int i = 0; i < n; i++) { move_inside(i); if (press_button() > K) { move_outside(i); continue; } in.push_back(i); res++; } for (auto &&i : in) move_outside(i); return res; } int min_cardinality(int N) { n = N; int nbTypes = posOfKFirstOf(1); int left = 1, right = n - 1; while (left < right) { int mid = (left + right) / 2; if (posOfKFirstOf(mid) < nbTypes * mid) right = mid - 1; else left = mid + 1; } return left - 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...