Submission #631132

#TimeUsernameProblemLanguageResultExecution timeMemory
631132il9Rarest Insects (IOI22_insects)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "insects.h"
using namespace std;
int min_cardinality(int n)
{
    for(int i =0;i<n;i++)
    {
        move_inside(i);

    }
     int high=press_button()+1;
    for(int i=0;i<n;i++) move_outside(i);
    int low=2;

    int mid;
    bool inside[n];
    for(int i=0;i<n;i++)
    {
        inside[i]=0;
    }
    int types=0;
    for(int i=0;i<n;i++)
    {
        move_inside(i);
        if(press_button()==1)
        {
            types++;
        }else
        {
            move_oustide(i);
        }


    }
        for(int i=0;i<n;i++)
    {
       move_outside(i);

    }
    int added=0;
    while(low<high)
    {
        mid=(low+high)/2;

        for(int i=0;i<n;i++)
        {
            if(!inside[i])
            {


                move_inside(i);
                inside[i]=1;
                int tp=press_button();
                added++;
                if(tp>mid)
                {
                    inside[i]=0;
                    added--;
                    move_outside(i);
                }
            }


        }
        if(types*mid==added)
        {
            low=mid+1;
        }else
        {

            high=mid;
            added=0;
            for(int i=0;i<n;i++)
            {
                inside[i]=0;
                move_outside(i);
            }
        }


    }
    return high-1;


}

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:30:13: error: 'move_oustide' was not declared in this scope; did you mean 'move_outside'?
   30 |             move_oustide(i);
      |             ^~~~~~~~~~~~
      |             move_outside