#include "insects.h"
#include "bits/stdc++.h"
using namespace std;
vector<int> v;
int D;
void Clear(){
while(!v.empty()){
move_outside(v.back());
v.pop_back();
}
}
int min_cardinality(int n){
for(int i=0;i<n;i++){
v.push_back(i);
move_inside(i);
int u = press_button();
if(u == 1) continue;
move_outside(i);
v.pop_back();
}
D = (int) v.size();
if(D > n / 2) return 1;
if(D == 1) return n;
int _n = n;
while(_n > D){
int B = _n / D;
Clear();
for(int i=0;i<n;i++){
v.push_back(i);
move_inside(i);
int u = press_button();
if(u > B){
move_outside(i);
v.pop_back();
}
}
if(v.size() == B * D) return B;
_n = v.size();
}
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |