제출 #635042

#제출 시각아이디문제언어결과실행 시간메모리
635042coloboxx드문 곤충 (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...