| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 725650 | aykhn | Rarest Insects (IOI22_insects) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
int min_cardinality(int n)
{
int sz = 0;
vector<bool> mark(n, 0);
for (int i = 0; i < n; i++)
{
move_inside(i);
int x = press_button();
if (x > 1) move_outside(i);
else
{
sz++;
mark[i] = true;
}
}
for (int i = 0; i < n; i++)
{
if (mark[i]) move_outside(i);
mark[i] = false;
}
int mxposs = inf;
int m = n;
while (mxposs > 1)
{
mxposs = m/sz;
int rn = 0;
vector<int> temp;
for (int i = 0; i < n; i++)
{
move_inside(i);
int x = press_button();
if (x > mxposs)
{
move_outside(i);
}
else
{
rn++;
temp.pb(i);
}
}
for (int i : temp) move_outside(i);
if (rn == mxposs * sz) break;
m = rn;
}
return mxposs;
}
