제출 #726351

#제출 시각아이디문제언어결과실행 시간메모리
726351ismayil드문 곤충 (IOI22_insects)C++17
50.03 / 100
201 ms408 KiB
#pragma GCC optimize("O3") #include "insects.h" #include <bits/stdc++.h> using namespace std; //g++ -std=c++17 insects.cpp stub.cpp int D, N; const int MAX = 3000; int is_in[MAX]; int cnt = 0; bool check(int m){ vector<int> new_in; for(int j = 0; j < N; j++){ if(is_in[j]) continue; move_inside(j); if(press_button() > m){ move_outside(j); }else{ cnt++; is_in[j] = 1; new_in.push_back(j); } } bool flag = false; if(cnt < m * D){ flag = true; cnt -= new_in.size(); for(auto i : new_in) move_outside(i), is_in[i] = 0; } return flag; } int min_cardinality(int n) { N = n; for(int j = 0; j < N; j++){ move_inside(j); if(press_button() > 1){ move_outside(j); }else{ cnt++; is_in[j] = 1; } } D = cnt; int l = 1, r = N / D; while(l <= r){ int m = (l + r) / 2; if(check(m)) r = m - 1; else l = m + 1; } return r; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...