제출 #1078184

#제출 시각아이디문제언어결과실행 시간메모리
1078184Muhammad_Aneeq드문 곤충 (IOI22_insects)C++17
0 / 100
1 ms344 KiB
void move_inside(int i); void move_outside(int i); int press_button(); #include <iostream> #include <vector> #include <map> #include <set> #include <bitset> using namespace std; int const MAXN=2000; bitset<MAXN>ind,ni; int min_cardinality(int N) { int colors=0; for (int i=0;i<N;i++) { move_inside(i); ind[i]=1; if (press_button()==2) { move_outside(i); ind[i]=0; } else colors++; } for (int i=0;i<N;i++) ni[i]=1-ind[i]; if (colors==1) return N; int st=1,en=N/colors+1; int cnt=colors; while (st+1<en) { int mid=(st+en)/2; for (int i=0;i<N;i++) { if (cnt==mid*colors) break; if (ni[i]) { move_inside(i); ind[i]=1; if (press_button()>mid) { ind[i]=0; move_outside(i); } } else cnt++; } if (cnt==mid*colors) { for (int i=0;i<N;i++) ni[i]=1-ind[i]; st=mid; } else { en=mid; for (int i=0;i<N;i++) { if (ind[i]) { ind[i]=0; ni[i]=1; } else ni[i]=0; } cnt=0; } } return st; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...