This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
int min_cardinality(int n)
{
int pos[n]={0},type=1;
for (int i=0;i<n;i++)
{
if (pos[i]!=0)
continue;
pos[i]=type;
move_inside(i);
for (int j=i+1;j<n;j++)
{
if (pos[j]!=0)
continue;
move_inside(j);
int p=press_button();
if (p==2)
pos[j]=type;
move_outside(j);
}
move_outside(i);
type++;
}
sort(pos,pos+n);
int rarest=INT_MAX,following=1;
for (int i=1;i<n;i++)
{
if (pos[i]!=pos[i-1])
rarest=min(rarest,following),following=1;
else
following++;
}
rarest=min(rarest,following);
return rarest;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |