제출 #1214957

#제출 시각아이디문제언어결과실행 시간메모리
1214957dosts드문 곤충 (IOI22_insects)C++20
10 / 100
100 ms448 KiB
#include "insects.h"
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
//#define int long long
#define pii pair<int,int>
#define vi vector<int>
#define ff first
#define ss second
#define sp << " " <<
#define all(x) x.begin(),x.end()
#define big(x) ((int)(x.size()))
using namespace std;
const int MOD = 1e9+7, LIM = 1e6+1, inf = 2e9;
int min_cardinality(int N) {
  vi machine;
  vi cand,cand2;
  for (int i = 0;i<N;i++) cand.push_back(i);
  vi inside(N,0);
  while (1) {
    for (auto it : cand) if (!inside[it]) move_inside(it),inside[it] = 1;
    int x = press_button();
    vi rem;
    for (auto it : cand) {
      move_outside(it);
      inside[it] = 0;
      int y = press_button();
      if (y<x) rem.push_back(it);
      else continue;
      move_inside(it);
      inside[it] = 1;
    }
    if (rem.size() == cand.size()) return x;
    if (rem.empty()) return x;
    for (auto it : cand) {
      if (!count(all(rem),it)) {
        cand2.push_back(it);
      }
      else {
        move_outside(it);
      }
    }
    cand.swap(cand2);
    cand2.clear();
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...