Submission #627378

# Submission time Handle Problem Language Result Execution time Memory
627378 2022-08-12T14:00:57 Z kkkkkkkk Rarest Insects (IOI22_insects) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

int min_cardinality(int n)
{
    int pos[n]={0},type=1;
    for (int i=0;i<n;i++)
    {
        if (pos[i]!=0)
            continue;
        pos[i]=type;
        move_inside(i);
        for (int j=i+1;j<n;j++)
        {
            if (pos[i]!=0)
                continue;
            move_inside(j);
            int p=press_button();
            if (p==2)
                pos[i]=type;
            move_outside(j);
        }
        move_outside(i);
        type++;
    }
    sort(pos,pos+n);
    int rarest=INT_MAX,following=1;
    for (int i=1;i<n;i++)
    {
        if (pos[i]!=pos[i-1])
            rarest=min(rarest,following),following=1;
        else
            following++;
    }
    rarest=min(rarest,following);
    return rarest;
}

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:14:9: error: 'move_inside' was not declared in this scope
   14 |         move_inside(i);
      |         ^~~~~~~~~~~
insects.cpp:20:19: error: 'press_button' was not declared in this scope
   20 |             int p=press_button();
      |                   ^~~~~~~~~~~~
insects.cpp:23:13: error: 'move_outside' was not declared in this scope
   23 |             move_outside(j);
      |             ^~~~~~~~~~~~
insects.cpp:25:9: error: 'move_outside' was not declared in this scope
   25 |         move_outside(i);
      |         ^~~~~~~~~~~~