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"
#ifdef NYAOWO
#include "stub.cpp"
#endif
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
// #define int LL
using namespace std;
using i32 = int32_t;
using LL = long long;
using pii = pair<int, int>;
int min_cardinality(int n) {
vector<int> alive;
For(i, 0, n - 1) alive.eb(i);
mt19937_64 rng(48763);
shuffle(all(alive), rng);
int mn = n * 8;
while(sz(alive)) {
int rep = alive.back();
alive.pop_back();
move_inside(rep);
vector<int> v0, v1(1, rep);
for(auto &i:alive) {
move_inside(i);
if(press_button() == 2) v1.eb(i);
else v0.eb(i);
move_outside(i);
}
move_outside(rep);
mn = min(mn, sz(v1));
alive.swap(v0);
}
return mn;
}
/*
6
5 8 9 5 9 9
1
7
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |