# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1051178 | Trent | Rarest Insects (IOI22_insects) | C++17 | 202 ms | 596 KiB |
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;
#define forR(i, x) for(int i = 0; i < (x); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
int INF = 1e7;
int min_cardinality(int N) {
vvi dst;
set<int> vals;
forR(i, N) vals.insert(i);
while(dst.size() <= 1 || dst[dst.size() - 1].size() == dst[dst.size() - 2].size()) {
dst.emplace_back();
for(int i : vals) {
move_inside(i);
if(press_button() == dst.size()) {
dst.back().push_back(i);
} else {
move_outside(i);
}
}
for(int i : dst.back()) vals.erase(vals.find(i));
if(dst.size() == 1 && dst.back().size() <= 32) {
for(int i : dst.back()) move_outside(i);
int mVal = INF;
for(int i : dst.back()) {
move_inside(i);
int tot = 0;
for(int j : vals) {
move_inside(j);
if(press_button() == 2) ++tot;
move_outside(j);
}
mVal = min(mVal, tot + 1);
move_outside(i);
}
return mVal;
}
}
// for(vi& i : dst) {
// for(int j : i) cerr << j << ' ';
// cerr << '\n';
// }
return dst.size() - 1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |