#include<bits/stdc++.h>
#include "insects.h"
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
int min_cardinality(int n){
int d=0;
vector<bool>used(n,0);
vector<int>st;
for(int i=0;i<n;i++){
d++;
move_inside(i);
st.pb(i);
int cnt=press_button();
if(cnt>1){
move_outside(i);
st.pop_back();
d--;
}
else{
used[i]=true;
}
}
int l=1,r=n/d;
int last=1;
while(l<r){
int mid=(l+r+1)/2;
vector<int>added;
int len=last*d;
for(int i=0;i<n;i++){
if(!used[i]){
move_inside(i);
if(press_button()>mid){
move_outside(i);
}
else{
len++;
added.pb(i);
}
}
}
if(len==mid+1){
for(int i:added){
used[i]=true;
}
last=mid;
}
else{
r=mid-1;
}
}
return l;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Wrong answer. |
3 |
Halted |
0 ms |
0 KB |
- |