제출 #627376

#제출 시각아이디문제언어결과실행 시간메모리
627376haojiandan드문 곤충 (IOI22_insects)C++17
53.16 / 100
185 ms420 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; int n; int min_cardinality(int _n) { n=_n; vector<int> V; int cnt=0; for (int i=0;i<n;i++) { move_inside(i); if (press_button()>1) move_outside(i),V.push_back(i); else cnt++; } if (cnt==1) return n; int l=2,r=n/cnt,mid,res=1; int lst=1; while (l<=r) { mid=(l+r)>>1; vector<int> V1,V2; int c=0; for (int &x : V) { move_inside(x); if (press_button()>mid) move_outside(x),V2.push_back(x); else c++,V1.push_back(x); } if (c==cnt*(mid-lst)) { res=mid; V.swap(V2); lst=mid; l=mid+1; } else { r=mid-1; for (int &x : V1) move_outside(x); } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...