# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
629368 | dacin21 | Rarest Insects (IOI22_insects) | C++17 | 67 ms | 464 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"
/*
void move_inside(int i);
void move_outside(int i);
int press_button();
*/
#include <bits/stdc++.h>
using namespace std;
vector<int> in, out;
void one_pass(vector<int> pool, int tr){
in.clear();
out.clear();
for(auto &e : pool){
move_inside(e);
if(press_button() > tr){
move_outside(e);
out.push_back(e);
} else {
in.push_back(e);
}
}
for(auto &e : in){
move_outside(e);
}
}
int min_cardinality(int n) {
vector<int> all(n);
iota(all.begin(), all.end(), 0);
one_pass(all, 1);
const int B = in.size();
int ans = 1;
all = out;
while(all.size() >= B){
const int l = 0, r = all.size()/B;
// const int t = (all.size() / B + 1) / 2;
const int t = (l+r+1+(2*(all.size()%B) >= B))/2;
one_pass(all, t);
if(in.size() == t*B){
ans += t;
all = out;
} else {
all = in;
}
}
return ans;
}
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... |