#include <bits/stdc++.h>
#include "insects.h"
using namespace std;
template <typename T>
using v = vector<T>;
using pii = pair<int, int>;
using ll = long long;
#define rep(i, k, n) for (int i = k; i < n; i++)
bool cont(v<bool> &marked) {
bool can = false;
for (auto x : marked) {
if (x == false) can = true;
}
return can;
}
int min_cardinality(int N) {
v<bool> marked(N, false);
int unused = N;
int ans = 1e9;
rep(i, 0, N) {
if (ans == 1) break;
if (marked[i]) continue;
move_inside(i);
int cmp = 1;
if (!cont(marked)) break;
marked[i] = true;
rep(j, i+1, N) {
if (marked[j]) continue;
move_inside(j);
int a = press_button();
if (a == 2) {
marked[j] = true;
unused--;
cmp++;
}
move_outside(j);
}
move_outside(i);
ans = min({
ans,
cmp,
});
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |