# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1077557 | Muhammad_Aneeq | Rarest Insects (IOI22_insects) | C++17 | 194 ms | 1184 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.
void move_inside(int i);
void move_outside(int i);
int press_button();
#include <iostream>
#include <vector>
using namespace std;
int min_cardinality(int N)
{
int colors=0;
vector<int>ind;
for (int i=0;i<N;i++)
{
move_inside(i);
if (press_button()==2)
move_outside(i);
else
{
colors++;
ind.push_back(i);
}
}
for (auto i:ind)
move_outside(i);
int st=1,en=N+1;
while (st+1<en)
{
int mid=(st+en)/2;
ind={};
for (int i=0;i<N;i++)
{
move_inside(i);
if (press_button()>mid)
move_outside(i);
else
ind.push_back(i);
}
if (ind.size()==mid*colors)
st=mid;
else
en=mid;
for (auto i:ind)
move_outside(i);
}
return st;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |