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 <bits/stdc++.h>
#include "insects.h"
using namespace std;
typedef long long ll;
void move_inside(int i);
void move_outside(int i);
int press_button();
int min_cardinality(int n){
vector<ll> v(n, -1);
v[0]=0;
ll l=1;
for(ll i=1; i<n; i++){
move_inside(i);
for(ll j=0; j<i; j++){
move_inside(j);
ll k=press_button();
move_outside(j);
if(k==2) {
v[i]=v[j];
break;
}
}
move_outside(i);
if(v[i]==-1) {
v[i]=l;
l++;
}
}
vector<ll> c(n, 0);
for(ll i=0; i<n; i++){
c[v[i]]++;
}
ll mn=0;
for(ll i=0; i<n; i++){
if(c[mn]>c[i] && c[i]!=0) mn=i;
}
return c[mn];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |