답안 #859822

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
859822 2023-10-10T18:15:34 Z vjudge1 드문 곤충 (IOI22_insects) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;

int min_cardinality(int N){
    vector<int> u;
    map<int, int> tipo;
    vector<int> v;
    for(int i=0; i<N; i++){
        move_inside(i);
        if(press_button()==1){
            u.push_back(i);
            tipo[i]=u.size()-1;
        }else{
            move_outside(i);
            v.push_back(i);
        }
    }
    for(int i: u) move_outside(i);
    int pot=1;
    int U = u.size();
    while(pot<=U){
        for(int i: u) if((tipo[i]&pot)!=0) move_inside(i);
        for(int i:v){
            move_inside(i);
            if(press_button()!=1){
                tipo[i]+=pot;
            }
            move_outside(i);
        }
        for(int i: u) if((tipo[i]&pot)!=0) move_outside(i);
        pot*=2;
    }
    map<int, int> m;
    for(int i=0; i<N; i++) m[tipo[i]]++;
    int minimo = N;
    for(auto l: m){
        minimo=min(minimo, l.second);
    }
    return minimo;
}

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:9:9: error: 'move_inside' was not declared in this scope
    9 |         move_inside(i);
      |         ^~~~~~~~~~~
insects.cpp:10:12: error: 'press_button' was not declared in this scope
   10 |         if(press_button()==1){
      |            ^~~~~~~~~~~~
insects.cpp:14:13: error: 'move_outside' was not declared in this scope
   14 |             move_outside(i);
      |             ^~~~~~~~~~~~
insects.cpp:18:19: error: 'move_outside' was not declared in this scope
   18 |     for(int i: u) move_outside(i);
      |                   ^~~~~~~~~~~~
insects.cpp:22:44: error: 'move_inside' was not declared in this scope
   22 |         for(int i: u) if((tipo[i]&pot)!=0) move_inside(i);
      |                                            ^~~~~~~~~~~
insects.cpp:24:13: error: 'move_inside' was not declared in this scope
   24 |             move_inside(i);
      |             ^~~~~~~~~~~
insects.cpp:25:16: error: 'press_button' was not declared in this scope
   25 |             if(press_button()!=1){
      |                ^~~~~~~~~~~~
insects.cpp:28:13: error: 'move_outside' was not declared in this scope
   28 |             move_outside(i);
      |             ^~~~~~~~~~~~
insects.cpp:30:44: error: 'move_outside' was not declared in this scope
   30 |         for(int i: u) if((tipo[i]&pot)!=0) move_outside(i);
      |                                            ^~~~~~~~~~~~