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;
int n;
bool check(int a) {
vector<bool> bruh(n,true);
int br = n;
for(int i = 0; i < n; i++) {
move_inside(i);
if(press_button() > a) {
bruh[a] = false;
move_outside(i);
br--;
}
}
for(int i = 0; i < n; i++) {
if(bruh[i]) {
move_outside(i);
}
}
if(br == n*a) {
return false;
}
else {
return true;
}
}
int min_cardinality(int N) {
n = N;
int l = 1,r = n,m;
while(l < r) {
m = (l+r)/2;
if(check(m)) {
r = m;
}
else {
l = m+1;
}
}
return l;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |