Submission #635042

#TimeUsernameProblemLanguageResultExecution timeMemory
635042coloboxxRarest Insects (IOI22_insects)C++17
47.50 / 100
290 ms368 KiB
#include "insects.h" #include <vector> using namespace std; int n; int count_insects(int bound) { vector<int> insects; for (int i = 0; i < n; i++) { move_inside(i); if (press_button() > bound) move_outside(i); else insects.push_back(i); } for (auto i : insects) move_outside(i); return (int)insects.size(); } int min_cardinality(int N) { n = N; int groups = count_insects(1); int l = 2, r = n, ans = 1; while (l <= r) { int mid = (l + r) / 2; if (count_insects(mid) == groups * mid) { ans = mid; l = mid + 1; } else r = mid - 1; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...