제출 #788948

#제출 시각아이디문제언어결과실행 시간메모리
788948mosiashvililuka드문 곤충 (IOI22_insects)C++17
0 / 100
46 ms316 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],ZED[2009],FORA; 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=0; i<=a+1; i++){ ZED[i]=0; } for(i=1; i<=a; i++){ if(BO[i]!=0) continue; ADD(i); c=ask(); if(c>mid-FORA){ REM(i);ZED[i]=1; }else{ ; } } zx=0; for(i=1; i<=a; i++){ if(bo[i]==1) zx++; } if(zx==(mid-FORA)*raod){ lef=mid;//FORA=mid; for(i=1; i<=a; i++){ if(bo[i]==1){ BO[i]=2;//shegidzlia yvelas mid occurence amoshalo } } //lef=mid; }else{ rig=mid; for(i=1; i<=a; i++){ if(ZED[i]==1){ BO[i]=1; } } 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...