Submission #1214950

#TimeUsernameProblemLanguageResultExecution timeMemory
1214950dostsRarest Insects (IOI22_insects)C++20
0 / 100
0 ms416 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);
  int iter = 20;
  while (iter--) {
    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);
      int y = press_button();
      if (y<x) rem.push_back(it);
      move_inside(it);
    }
    for (auto it : cand) {
      if (!count(all(rem),it)) {
        cand2.push_back(it);
      }
      else {
        move_outside(it);
      }
    }
    cand.swap(cand2);
    cand2.clear();
    if (cand.empty()) return x;
  }
}

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:43:1: warning: control reaches end of non-void function [-Wreturn-type]
   43 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...