#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;
}
while (crr.size()){
move_outside(crr.back());
crr.pop_back();
}
return boolean;
};
while (l<r){
int mid = l+(r-l)/2;
if (check(mid)){
r=mid;
}
else {
l=mid+1;
}
}
return l;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Incorrect |
0 ms |
208 KB |
Wrong answer. |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Incorrect |
0 ms |
208 KB |
Wrong answer. |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Incorrect |
1 ms |
208 KB |
Wrong answer. |
7 |
Halted |
0 ms |
0 KB |
- |