제출 #725650

#제출 시각아이디문제언어결과실행 시간메모리
725650aykhn드문 곤충 (IOI22_insects)C++17
컴파일 에러
0 ms0 KiB
int min_cardinality(int n) { int sz = 0; vector<bool> mark(n, 0); for (int i = 0; i < n; i++) { move_inside(i); int x = press_button(); if (x > 1) move_outside(i); else { sz++; mark[i] = true; } } for (int i = 0; i < n; i++) { if (mark[i]) move_outside(i); mark[i] = false; } int mxposs = inf; int m = n; while (mxposs > 1) { mxposs = m/sz; int rn = 0; vector<int> temp; for (int i = 0; i < n; i++) { move_inside(i); int x = press_button(); if (x > mxposs) { move_outside(i); } else { rn++; temp.pb(i); } } for (int i : temp) move_outside(i); if (rn == mxposs * sz) break; m = rn; } return mxposs; }

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

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:6:5: error: 'vector' was not declared in this scope
    6 |     vector<bool> mark(n, 0);
      |     ^~~~~~
insects.cpp:6:12: error: expected primary-expression before 'bool'
    6 |     vector<bool> mark(n, 0);
      |            ^~~~
insects.cpp:10:9: error: 'move_inside' was not declared in this scope
   10 |         move_inside(i);
      |         ^~~~~~~~~~~
insects.cpp:11:17: error: 'press_button' was not declared in this scope
   11 |         int x = press_button();
      |                 ^~~~~~~~~~~~
insects.cpp:12:20: error: 'move_outside' was not declared in this scope
   12 |         if (x > 1) move_outside(i);
      |                    ^~~~~~~~~~~~
insects.cpp:16:13: error: 'mark' was not declared in this scope
   16 |             mark[i] = true;
      |             ^~~~
insects.cpp:21:13: error: 'mark' was not declared in this scope
   21 |         if (mark[i]) move_outside(i);
      |             ^~~~
insects.cpp:21:22: error: 'move_outside' was not declared in this scope
   21 |         if (mark[i]) move_outside(i);
      |                      ^~~~~~~~~~~~
insects.cpp:22:9: error: 'mark' was not declared in this scope
   22 |         mark[i] = false;
      |         ^~~~
insects.cpp:25:18: error: 'inf' was not declared in this scope; did you mean 'int'?
   25 |     int mxposs = inf;
      |                  ^~~
      |                  int
insects.cpp:31:16: error: expected primary-expression before 'int'
   31 |         vector<int> temp;
      |                ^~~
insects.cpp:34:13: error: 'move_inside' was not declared in this scope
   34 |             move_inside(i);
      |             ^~~~~~~~~~~
insects.cpp:35:21: error: 'press_button' was not declared in this scope
   35 |             int x = press_button();
      |                     ^~~~~~~~~~~~
insects.cpp:38:17: error: 'move_outside' was not declared in this scope
   38 |                 move_outside(i);
      |                 ^~~~~~~~~~~~
insects.cpp:43:17: error: 'temp' was not declared in this scope
   43 |                 temp.pb(i);
      |                 ^~~~
insects.cpp:46:22: error: 'temp' was not declared in this scope
   46 |         for (int i : temp) move_outside(i);
      |                      ^~~~
insects.cpp:46:28: error: 'move_outside' was not declared in this scope
   46 |         for (int i : temp) move_outside(i);
      |                            ^~~~~~~~~~~~