제출 #628963

#제출 시각아이디문제언어결과실행 시간메모리
628963dqhungdl드문 곤충 (IOI22_insects)C++17
컴파일 에러
0 ms0 KiB
//#include "insects.h" #include <bits/stdc++.h> using namespace std; int diff = 0; vector<bool> mark, used; void countDiff(int N) { for (int i = 0; i < N; i++) { move_inside(i); if (press_button() == 1) { diff++; mark[i] = true; } else move_outside(i); } } bool check(int lim, int N) { if (press_button() > lim) { for (int i = 0; i < N; i++) if (!mark[i]) used[i] = true; for (int i = 0; i < N; i++) if (mark[i]) { mark[i] = false; move_outside(i); } } int cnt = accumulate(mark.begin(), mark.end(), 0); for (int i = 0; i < N; i++) if (!mark[i] && !used[i]) { move_inside(i); int tmp = press_button(); if (tmp > lim) move_outside(i); else { cnt++; mark[i] = true; if (cnt == lim * diff) break; } } return cnt < lim * diff; } int min_cardinality(int N) { mark.resize(N); used.resize(N); countDiff(N); int l = 2, r = N / diff, rs = 1; while (l <= r) { int mid = l + (r - l) / 2; if (check(mid, N)) r = mid - 1; else { rs = mid; l = mid + 1; } } return rs; }

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

insects.cpp: In function 'void countDiff(int)':
insects.cpp:10:9: error: 'move_inside' was not declared in this scope
   10 |         move_inside(i);
      |         ^~~~~~~~~~~
insects.cpp:11:13: error: 'press_button' was not declared in this scope
   11 |         if (press_button() == 1) {
      |             ^~~~~~~~~~~~
insects.cpp:15:13: error: 'move_outside' was not declared in this scope
   15 |             move_outside(i);
      |             ^~~~~~~~~~~~
insects.cpp: In function 'bool check(int, int)':
insects.cpp:20:9: error: 'press_button' was not declared in this scope
   20 |     if (press_button() > lim) {
      |         ^~~~~~~~~~~~
insects.cpp:27:17: error: 'move_outside' was not declared in this scope
   27 |                 move_outside(i);
      |                 ^~~~~~~~~~~~
insects.cpp:33:13: error: 'move_inside' was not declared in this scope
   33 |             move_inside(i);
      |             ^~~~~~~~~~~
insects.cpp:34:23: error: 'press_button' was not declared in this scope
   34 |             int tmp = press_button();
      |                       ^~~~~~~~~~~~
insects.cpp:36:17: error: 'move_outside' was not declared in this scope
   36 |                 move_outside(i);
      |                 ^~~~~~~~~~~~