Submission #634092

#TimeUsernameProblemLanguageResultExecution timeMemory
634092ikura355Rarest Insects (IOI22_insects)C++17
0 / 100
0 ms208 KiB
#include "insects.h" #include <vector> using namespace std; const int maxn = 2e3 + 5; int n; vector<int> insects; bool ban[maxn]; int count_insects(int bound) { insects.clear(); for (int i = 0; i < n; i++) { if (ban[i]) continue; 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); if (groups == n) return 1; for (auto i : insects) ban[i] = 1; int l = 2, r = n / groups, ans = 1; while (l <= r) { int mid = (l + r) / 2; if (count_insects(mid) == groups * (mid - ans)) { ans = mid; for (auto i : insects) ban[i] = 1; 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...