이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MAXN = 1e6 + 10;
int n;
bool flag[MAXN];
int min_cardinality(int n_) {
n = n_;
vector<int> vec;
for (int i = 0; i < n; i++)
vec.push_back(i);
int base_size = MAXN;
for (int i = 1; i <= n + 1; i++) {
shuffle(all(vec), rng);
int tsize = 0;
for (int e : vec) {
if (!flag[e]) {
move_inside(e);
if (press_button() == i) tsize++, flag[e] = true;
else move_outside(e);
if (tsize == base_size) break;
}
}
if (tsize < base_size) {
if (base_size == MAXN) base_size = tsize;
else return i - 1;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |