# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
742650 | doowey | Rarest Insects (IOI22_insects) | C++17 | 176 ms | 368 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 <bits/stdc++.h>
#include "insects.h"
using namespace std;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
int min_cardinality(int n) {
int val;
vector<int> in;
for(int i = 0 ; i < n; i ++ ){
move_inside(i);
val = press_button();
if(val > 1){
move_outside(i);
}
else{
in.push_back(i);
}
}
int dist = in.size();
int l = 1;
int r = n/dist + 1;
int mid;
while(l + 1 < r){
mid = (l + r) / 2;
if(mid * dist > n){
r = mid;
continue;
}
for(auto x : in){
move_outside(x);
}
in.clear();
for(int i = 0 ; i < n; i ++ ){
move_inside(i);
val = press_button();
if(val > mid){
move_outside(i);
}
else{
in.push_back(i);
}
}
if(in.size() == mid * dist){
l = mid;
}
else{
r = mid - 1;
}
}
return l;
}
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... |