제출 #629247

#제출 시각아이디문제언어결과실행 시간메모리
629247kdh9949드문 곤충 (IOI22_insects)C++17
50 / 100
173 ms444 KiB
#include "insects.h" const int M = 2005; int chk[M], cnt; int IN(int x) { if(chk[x]) return 0; chk[x] = 1; cnt++; move_inside(x); return 1; } int OUT(int x) { if(!chk[x]) return 0; chk[x] = 0; cnt--; move_outside(x); return 1; } int GET() { return press_button(); } int min_cardinality(int N) { IN(0); for(int i = 1; i < N; i++) { IN(i); if(GET() != 1) OUT(i); } int K = cnt; int L = 1, R = N / K; while(L < R) { int M = (L + R) / 2; for(int i = 0; i < N; i++) { if(IN(i)) { if(GET() > M + 1) OUT(i); } } if(cnt == (M + 1) * K) L = M + 1; else { for(int i = 0; i < N; i++) OUT(i); R = M; } } return L; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...