제출 #413584

#제출 시각아이디문제언어결과실행 시간메모리
413584timmyfeng콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "combo.h" string guess_sequence(int n) { string ans; if (press("AB") > 0) { ans = press("A") > 0 ? "A" : "B"; } else { ans = press("X") > 0 ? "X" : "Y"; } string buttons = "ABXY"; buttons.erase(find(buttons.begin(), buttons.end(), ans[0])); for (int i = 1; i < n - 1; ++i) { string ask = ans + buttons[1]; for (int j = 0; j < 3; ++j) { ask += ans + buttons[2] + buttons[j]; } int res = press(ask); for (int j = 0; j < 3; ++j) { if (res == i + j) { ans += buttons[j]; } } } for (int i = 0; i < 2; ++i) { if (press(ans + button[i]) == n) { return ans + button[i]; } } return ans + button[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:33:25: error: 'button' was not declared in this scope; did you mean 'buttons'?
   33 |         if (press(ans + button[i]) == n) {
      |                         ^~~~~~
      |                         buttons
combo.cpp:38:18: error: 'button' was not declared in this scope; did you mean 'buttons'?
   38 |     return ans + button[2];
      |                  ^~~~~~
      |                  buttons