# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
825836 | 2023-08-15T08:44:10 Z | LittleCube | Rarest Insects (IOI22_insects) | C++17 | 1 ms | 208 KB |
#include "insects.h" #include <bits/stdc++.h> #define ll long long using namespace std; const double r = 0.5; int min_cardinality(int N) { vector<int> remain; int M = N, L = 1, R = N; /* Choose k: ans <= k -> R = k ans > k -> L = k + 1, M -= k */ for (int i = 0; i < N; i++) remain.emplace_back(i); while (L < R) { int k = (L + R) / 2; vector<int> small, large, tmp; for (int i : remain) { move_inside(i); if (press_button() > k) { move_outside(i); large.emplace_back(i); } else small.emplace_back(i); } int big = !large.empty(); remain.clear(); for (auto i : small) move_outside(i); for (auto i : large) { move_inside(i); if (press_button() == 2) move_outside(i); else tmp.emplace_back(i); } for (auto i : small) { move_inside(i); if (press_button() == 2) large.emplace_back(i); else remain.emplace_back(i); move_outside(i); } for (auto i : tmp) move_outside(i); if (big) remain = large, L = k + 1; else R = k; } return L; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Incorrect | 0 ms | 208 KB | Wrong answer. |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Incorrect | 0 ms | 208 KB | Wrong answer. |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 208 KB | Wrong answer. |
2 | Halted | 0 ms | 0 KB | - |