제출 #627654

#제출 시각아이디문제언어결과실행 시간메모리
627654Fischer드문 곤충 (IOI22_insects)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "insects.h" using namespace std; const int maxn = 2010; bool in[maxn]; pair<bool, int> p(int x, int N) { for (int i = 1; i <= N; ++i) { move_inside(i); in[i] = 1; if (press_button() > x) { move_outside(i); in[i] = 0; } } for (int i = 1; i <= N; ++i) { if (in[i]) { move_outside(i); } } int cnt = 0, bad = 0; for (int i = 1; i <= N; ++i) { if (in[i]) { move_inside(i); if (press_buton() >= x) { move_outside(i); bad += 1; } cnt += 1; in[i] = 0; } } return {cnt == bad * (x - 1), bad}; } int min_cardinality(int N) { pair<bool, int> temp; int lo = 1, hi = min(N, 1000); while (lo < hi) { int mid = (lo + hi + 1) / 2; if ((temp = p(mid, N)).first) lo = mid; else hi = mid-1; } if (lo == 1000 && temp.second == 1) return N; return lo; }

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

insects.cpp: In function 'std::pair<bool, int> p(int, int)':
insects.cpp:28:11: error: 'press_buton' was not declared in this scope; did you mean 'press_button'?
   28 |       if (press_buton() >= x) {
      |           ^~~~~~~~~~~
      |           press_button