Submission #741960

#TimeUsernameProblemLanguageResultExecution timeMemory
741960fanwenRarest Insects (IOI22_insects)C++17
Compilation error
0 ms0 KiB
#define ONLINE_JUDGE
#include <bits/stdc++.h>
// #include "insect.h"
using namespace std;

#define MASK(x) (1LL << (x))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(x) (x).begin(), (x).end()

#define REP(i, n) for (int i = 0, _n = n; i < _n; ++i)
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORD(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define FORE(it, s) for (__typeof(s.begin()) it = (s).begin(); it != (s).end(); ++it)

template <class U, class V> bool maximize(U &A, const V &B) { return (A < B) ? (A = B, true) : false; }
template <class U, class V> bool minimize(U &A, const V &B) { return (A > B) ? (A = B, true) : false; }


set <int> inside;
vector <int> insect;
/*
    void add(int i) {
        inside.insert(i);
        move_inside(i);
    }
    void del(int i) {
        inside.erase(inside.find(i));
        move_outside(i);
    }
*/

int min_cardinality(int n) {
    insect.assign(n, 0);
    iota(ALL(insect), 0);
    int ans = n;
    REP(i, n) {
        int cur = 1;
        stack <int> st;
        move_inside(insect[i]);
        st.push(insect[i]);
        REP(j, n) if(j != i) {
            move_inside(insect[j]);
            if(press_button() == cur + 1) cur++, st.push(insect[j]);
            else move_outside(insect[j]);
        }
        minimize(ans, cur);
        while((int) st.size() > 0) move_outside(st.top()), st.pop();

    }
    return ans;
}

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:39:9: error: 'move_inside' was not declared in this scope
   39 |         move_inside(insect[i]);
      |         ^~~~~~~~~~~
insects.cpp:43:16: error: 'press_button' was not declared in this scope
   43 |             if(press_button() == cur + 1) cur++, st.push(insect[j]);
      |                ^~~~~~~~~~~~
insects.cpp:44:18: error: 'move_outside' was not declared in this scope
   44 |             else move_outside(insect[j]);
      |                  ^~~~~~~~~~~~
insects.cpp:47:36: error: 'move_outside' was not declared in this scope
   47 |         while((int) st.size() > 0) move_outside(st.top()), st.pop();
      |                                    ^~~~~~~~~~~~