# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
346053 | athensclub | Counting Mushrooms (IOI20_mushrooms) | C++14 | 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 div2RoundUp(int x)
{
int d = x / 2;
if (d * 2 < x)
return d + 1;
return d;
}
int count_mushrooms(int n)
{
std::vector<int> m;
for (int i = 0; i < n; i++)
m.push_back(i);
int c1 = use_machine(m);
m = {0, 1};
int c2 = use_machine(m);
return c2 == 1 ? div2RoundUp(c1) : n - div2RoundUp(c1);
}