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;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
typedef vector<pi> pii;
typedef tuple<int,int,int> tii;
typedef vector<ll> li;
typedef vector<li> lii;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define LSOne(s) ((s)&(-s))
ll INF=1e18+10;
int inf=1e9+10;
ll M=1e9+7;
set<int> s,t;
int n;
int k=0;
int BS(int l,int r){
if(l==r)return l;
t=s;
int m=(l+r)/2+1;
REP(i,0,n){
if(s.count(i))continue;
s.insert(i);
move_inside(i);
if(press_button()<=m)continue;
s.erase(i);
move_outside(i);
}
int p=s.size();
if(p==m*k)return BS(m,r);
else {
for(auto u:s)if(t.count(u)==0)move_outside(u);
s=t;
return BS(l,m-1);
}
}
int min_cardinality(int N) {
n=N;
REP(i,0,n){
move_inside(i);k++;
if(press_button()>1){
move_outside(i);k--;
}
}
int ans=BS(1,2000);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |