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>
using namespace std;
#include "insects.h"
int min_cardinality(int N) {
int l = 1, r = N;
auto check = [&](int x)->bool{
vector<int> crr;
for (int i = 0; i < x; i++){
crr.push_back(i);
move_inside(i);
}
bool boolean=false;
for (int i = x; i < N; i++){
move_inside(i);
crr.push_back(i);
if (press_button()>x){
move_outside(i);
crr.pop_back();
}
else boolean=true;
}
return boolean;
while (crr.size()){
move_outside(crr.back());
crr.pop_back();
}
};
while (l<r){
int mid = l+(r-l)/2;
if (check(mid)){
r=mid;
}
else {
l=mid+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... |