제출 #1356277

#제출 시각아이디문제언어결과실행 시간메모리
1356277hexopia드문 곤충 (IOI22_insects)C++20
0 / 100
0 ms344 KiB
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
int n,num;
int min_cardinality(int N) {
  n = num = N;
  vector<int> a;
  for(int i = 0 ; i<n; ++i) {
    move_inside(i);
    if(press_button() > 1) move_outside(i),num--;
  }
  for(int i = 0 ; i<n ;++i) a.push_back(i);
  int l = 1,r = n/num;
  while(l<r) {
    int md = (l+r+1)/2;
    int cnt = l*num;
    vector<int> a1,a2;
    for(int x:a) {
      move_inside(x);
      if(press_button() > md) move_outside(x),a2.push_back(x);
      else a1.push_back(x),cnt++;
    }
    if(cnt == md*num) {
      a = a2;
      l = md;
    }
    else {
      for(int x:a1) move_outside(x);
      a = a1;
      r = md-1;
    }
  }
  return l;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…