Submission #831371

#TimeUsernameProblemLanguageResultExecution timeMemory
831371NeroZeinRarest Insects (IOI22_insects)C++17
10 / 100
280 ms404 KiB
#include "insects.h"
#include <bits/stdc++.h>
using namespace std; 

int min_cardinality(int N) {
  int n = N; 
  vector<bool> removed(n); 
  while (true) {
    set<int> to_remove;
    int not_removed = 0; 
    for (int i = 0; i < n; ++i) {
      if (!removed[i]) {
        move_inside(i); 
        not_removed++; 
      }
    }
    int x = press_button();
    if (x == 1 || x == not_removed) return x;
    for (int i = 0; i < n; ++i) {
      if (!removed[i]) {
        move_outside(i); 
        int y = press_button();
        if (y < x) {
          move_inside(i); 
          to_remove.insert(i); 
        }
      }
    }
    for (int i : to_remove) {
      move_outside(i); 
      removed[i] = true;
    }
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...