# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
723413 | LittleFlowers__ | Rarest Insects (IOI22_insects) | C++17 | 0 ms | 0 KiB |
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;
typedef long long ll;
typedef unsigned long long ull;
int hmt() {int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';if(n) x=-x;return x;}
#define in hmt()
#define ins ({string x;char c=getchar();for(;c==' '||c=='\n';c=getchar());for(;c!=' '&&c!='\n';c=getchar()) x+=c;x;})
#define forinc(i,a,b) for(int i=a,_b=b;i<=_b;++i)
#define fordec(i,a,b) for(int i=a;i>=b;--i)
#define forb(i,BS) for(int i=BS._Find_first();i< BS.size();i = BS._Find_next(i))
#define timer 1.0*clock()/CLOCKS_PER_SEC
#define forv(a,b) for(auto &a:b)
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define all(a) a.begin(),a.end()
#define reset(f,x) memset(f,x,sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define onbit(x,i) (x|(1<<(i-1)))
#define offbit(x,i) (x&~(1<<(i-1)))
int n,dd[2010];
vector<int> a,b;
/*void move_inside(int i) {}
void move_outside(int i) {}
int press_button() {}*/
int min_cardinality(int N) {
n=N;
forinc(i,0,n-1) a.pb(i);
random_shuffle(all(a));
while(1) {
reset(dd,0);
int sz=a.size();
int i=a[rand()%sz];
move_inside(i);
dd[i]=1;
int mx=1;
forv(j,a) if(!dd[j]) {
move_inside(j);
if(press_button()>mx) {
++mx;
dd[j]=1;
} else move_outside(j);
}
if(mx==sz||mx==1) return mx;
forv(j,a) if(dd[j]) move_outside(j);
random_shuffle(all(a));
if(sz%mx) --mx;
forv(j,a) if(!dd[j]) {
move_inside(j);
int press=press_button();
if(press>mx) {
move_outside(j);
} else b.pb(j);
}
swap(a,b);
b.clear();
}
}
/*int main() {
}*/