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)
{
bool vis[N]={};
int ans=N;
for (int i=0;i<N;i++)
{
if (vis[i])
continue;
vis[i]=1;
vector<int>f;
f.push_back(i);
move_inside(i);
int cnt=1;
for (int j=i+1;j<N;j++)
{
if (vis[j])
continue;
cnt++;
move_inside(j);
if (press_button()==cnt)
{
vis[j]=1;
f.push_back(j);
continue;
}
move_outside(j);
cnt--;
}
for (auto j:f)
move_outside(j);
ans=min(cnt,ans);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |