Submission #627449

# Submission time Handle Problem Language Result Execution time Memory
627449 2022-08-12T15:11:28 Z I_love_Hoang_Yen Rarest Insects (IOI22_insects) C++17
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
#define SZ(s) ((int) s.size())
using namespace std;

int min_cardinality(int n) {
    std::vector<int> v_ids(n);
    std::iota(v_ids.begin(), v_ids.end(), 0);

    std::set<int> ids(v_ids.begin(), v_ids.end());
    int freq = 0;

    while (true) {
        ++freq;
        std::set<int> new_ids;

        for (int id : ids) {
            move_inside(id);
            if (press_button() > freq) {
                move_outside(id);
                new_ids.insert(id);
            }
        }

        int unique_values = SZ(ids) - SZ(new_ids);
        if (unique_values > SZ(new_ids)) {
            return freq;
        }

        ids = std::move(new_ids);
    }

    return 0;
}

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:17:13: error: 'move_inside' was not declared in this scope
   17 |             move_inside(id);
      |             ^~~~~~~~~~~
insects.cpp:18:17: error: 'press_button' was not declared in this scope
   18 |             if (press_button() > freq) {
      |                 ^~~~~~~~~~~~
insects.cpp:19:17: error: 'move_outside' was not declared in this scope
   19 |                 move_outside(id);
      |                 ^~~~~~~~~~~~