제출 #788934

#제출 시각아이디문제언어결과실행 시간메모리
788934mosiashvililuka드문 곤충 (IOI22_insects)C++17
47.50 / 100
162 ms408 KiB
#include<bits/stdc++.h> #include "insects.h" using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,lef,rig,mid,bo[2009],raod,BO[2009]; vector <int> diff; void ADD(int i){ move_inside(i-1);bo[i]=1; } void REM(int i){ move_outside(i-1);bo[i]=0; } int ask(){ return press_button(); } int min_cardinality(int NN) { a=NN; for(i=1; i<=a; i++){ ADD(i); c=ask(); if(c>1){ REM(i); }else{ diff.push_back(i); } } for(i=1; i<=a; i++){ if(bo[i]==1) REM(i); } raod=diff.size(); lef=1;rig=a/raod+1; while(1){ if(lef+1>=rig) break; mid=(lef+rig)/2; for(i=1; i<=a; i++){ ADD(i); c=ask(); if(c>mid){ REM(i); }else{ ; } } zx=0; for(i=1; i<=a; i++){ if(bo[i]==1) zx++; } if(zx==mid*raod){ lef=mid; }else{ rig=mid; } for(i=1; i<=a; i++){ if(bo[i]==1) REM(i); } } return lef; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...