| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1359418 | opeleklanos | Rarest Insects (IOI22_insects) | C++20 | 0 ms | 0 KiB |
#include <iostream>
#include <vector>
using namespace std;
#include "insects.h"
int min_cardinality(int n){
vector<int> types(n, -1);
int count = 0;
int ans = n;
while(true){
int startInd = 0;
while(types[startInd] != -1 && startInd<n) startInd++;
if(startInd>=n) break;
types[startInd] = count;
move_inside(startInd);
int found = 1;
for(int i = startInd+1; i<n; i++){
if(types[i] != -1) continue;
move_inside(i);
if(press_button(i) == 2){
types[i] = count;
found++;
}
move_outside(i);
}
ans = min(ans, found);
}
return ans;
}