제출 #755118

#제출 시각아이디문제언어결과실행 시간메모리
755118Rafi22Rarest Insects (IOI22_insects)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define ll long long
ll mod=1000000007;
int inf=1000000007;
ll infl=1000000000000000007;

int ans=1,m;

void rek(vector<int>a)
{
    if(sz(a)<m) return ;
    int k=(sz(a)/m+1)/2;
    vector<int>T,N;
    bool is=0;
    for(auto x:a)
    {
        move_inside(x);
        int c=press_button();
        if(c>=k) is=1;
        if(c>k)
        {
            move_outside(x);
            N.pb(x);
        }
        else T.pb(x);
    }
    for(auto x:T) move_outside(x);
    if(is)
    {
        ans+=k;
        rek(N);
    }
    else rek(T);
}

int min_cardinality(int n)
{
    vector<int>V;
    for(int i=0;i<n;i++)
    {
        move_inside(i);
        if(press_button()>1)
        {
            move_outside(i);
            V.pb(i);
        }
        else m++;
    }
    rek(V);
    return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

insects.cpp: In function 'void rek(std::vector<int>)':
insects.cpp:26:9: error: 'move_inside' was not declared in this scope
   26 |         move_inside(x);
      |         ^~~~~~~~~~~
insects.cpp:27:15: error: 'press_button' was not declared in this scope
   27 |         int c=press_button();
      |               ^~~~~~~~~~~~
insects.cpp:31:13: error: 'move_outside' was not declared in this scope
   31 |             move_outside(x);
      |             ^~~~~~~~~~~~
insects.cpp:36:19: error: 'move_outside' was not declared in this scope
   36 |     for(auto x:T) move_outside(x);
      |                   ^~~~~~~~~~~~
insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:50:9: error: 'move_inside' was not declared in this scope
   50 |         move_inside(i);
      |         ^~~~~~~~~~~
insects.cpp:51:12: error: 'press_button' was not declared in this scope
   51 |         if(press_button()>1)
      |            ^~~~~~~~~~~~
insects.cpp:53:13: error: 'move_outside' was not declared in this scope
   53 |             move_outside(i);
      |             ^~~~~~~~~~~~