This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
int min_cardinality(int N) {
vector<bool> used(N);
int types = 0;
for (int i = 0; i < N; i++) {
move_inside(i);
if (press_button() > 1) {
move_outside(i);
continue;
}
types++;
used[i] = true;
}
//printf("types: %d\n", types);
for (int num = 2; num <= N; num++) {
int added = 0;
for (int i = 0; i < N; i++) {
if (used[i]) continue;
move_inside(i);
int p = press_button();
//printf("num: %d i: %d p: %d\n", num, i, p);
if (p > num) {
move_outside(i);
continue;
}
added++;
used[i] = true;
}
if (added != types) {
return num-1;
}
}
return N;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |