# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1240739 | nikulid | Digital Circuit (IOI22_circuit) | C++20 | 0 ms | 0 KiB |
#include "insects.h"
#include <vector>
using namespace std;
int min_cardinality(int N) {
vector<int> type(N);
int answer=2001;
for(int i=0; i<N; i++){
type[i]=i;
}
for(int l=0; l<N-1; l++){
if(type[l] != l) continue;
move_inside(l);
for(int r=l+1; r<N; r++){
move_inside(r);
if(press_button()==2){
// they are the same type...
type[r]=l;
}
move_outside(r);
}
move_outside(l);
}
vector<int> count(N, 0);
for(int i=0; i<N; i++){
count[type[i]]++;
}
for(int i=0; i<N; i++){
if(count[i]>0){
answer=min(answer,count[i]);
}
}
return answer;
}