#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
int min_cardinality(int N)
{
// Find the number of different insect types:
// Maximum number of insects with 1 being maximum
// Let that number be K
// Find another set of K numbers with 2 being the maximum
// Then 3 and 4 and so on untill it is no longer possible
// The grader is not adaptive:
vector<int> indicies(N);
iota(indicies.begin(), indicies.end(), 0);
mt19937 mt(time(0));
shuffle(indicies.begin(), indicies.end(), mt);
vector<int> in(N);
int k = 0;
for (int i = 0; i < N; i++)
{
move_inside(indicies[i]);
if (press_button() > 1)
{
move_outside(indicies[i]);
}
else
{
k++;
in[i] = 1;
}
}
int res = 1;
while (true)
{
int cnt = 0;
for (int i = 0; i < N && cnt < k; i++)
{
if (in[i]) continue;
move_inside(indicies[i]);
if (press_button() > res + 1)
{
move_outside(indicies[i]);
}
else
{
cnt++;
in[i] = 1;
}
}
if (cnt < k)
return res;
res++;
}
return res;
}
Compilation message
circuit.cpp:1:10: fatal error: insects.h: No such file or directory
1 | #include "insects.h"
| ^~~~~~~~~~~
compilation terminated.