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 min_cardinality(int n) {
int be = 1, ed = n, type = 0;
for(int i=0;i<n;i++){
move_inside(i);
if(press_button() > 1) move_outside(i);
else type++;
}
while(be <= ed){
int mid = (be+ed)/2, cnt = 0;
for(int i=0;i<n;i++) move_outside(i);
for(int i=0;i<n;i++){
move_inside(i);
if(press_button() > mid) move_outside(i);
else cnt++;
}
if(cnt == mid * type) be = mid+1;
else ed = mid-1;
}
return ed;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |