제출 #629081

#제출 시각아이디문제언어결과실행 시간메모리
629081handlename드문 곤충 (IOI22_insects)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair set<int> s; void add(int i){ move_inside(i); s.insert(i); } void rem(int i){ move_outside(i); s.erase(i); } int min_cardinality(int n){ for (int i=0;i<n;i++){ add(i); if (press_button()>1){ rem(i); } } int mini=1,maxi=n+1,sz=s.size(); while (mini+1<maxi){ int mid=(mini+maxi)/2; set<int> added; for (int i=0;i<n;i++){ if (s.find(i)!=s.end()) continue; add(i); if (press_button()>mid) rem(i); else added.insert(i); } if ((int)s.size()==sz*mid){ mini=mid; } else { maxi=mid; for (auto i:added) rem(i); } } return mini; }

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

insects.cpp: In function 'void add(int)':
insects.cpp:7:2: error: 'move_inside' was not declared in this scope
    7 |  move_inside(i);
      |  ^~~~~~~~~~~
insects.cpp: In function 'void rem(int)':
insects.cpp:11:2: error: 'move_outside' was not declared in this scope
   11 |  move_outside(i);
      |  ^~~~~~~~~~~~
insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:17:7: error: 'press_button' was not declared in this scope
   17 |   if (press_button()>1){
      |       ^~~~~~~~~~~~
insects.cpp:28:8: error: 'press_button' was not declared in this scope
   28 |    if (press_button()>mid) rem(i);
      |        ^~~~~~~~~~~~