Submission #634556

#TimeUsernameProblemLanguageResultExecution timeMemory
634556mosiashvililukaRarest Insects (IOI22_insects)C++17
10 / 100
194 ms324 KiB
#include<bits/stdc++.h> #include "insects.h" using namespace std; int BO[2009]; int a,b,c,d,e,i,j,ii,jj,zx,xc,f[2009],fx[2009]; void ins(int q){ BO[q]=1; move_inside(q-1); } void outs(int q){ BO[q]=0; move_outside(q-1); } int ask(){ return press_button(); } void clea(){ for(int h=1; h<=a; h++){ if(BO[h]==1){ outs(h); BO[h]=0; } } } int min_cardinality(int N) { a=N;zx=0; for(i=1; i<=a; i++){ for(j=1; j<i; j++){ ins(j);ins(i); if(ask()==2){ f[i]=f[j]; clea(); break; } clea(); } if(f[i]==0){ zx++;f[i]=zx; } } for(i=1; i<=a; i++){ fx[f[i]]++; } zx=a+2; for(i=1; i<=a; i++){ if(fx[i]==0) continue; zx=min(zx,fx[i]); } return zx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...