제출 #167106

#제출 시각아이디문제언어결과실행 시간메모리
167106minseo852콤보 (IOI18_combo)C++11
컴파일 에러
0 ms0 KiB
#include <string> #include <vector> #include <iostream> using namespace std; string guess_sequence(int N) { string start; if (press("AB") == 1) { start = (press("A") == 1 ? "A" : "B"); } else start = (press("X") == 1 ? "X" : "Y"); vector<string> others = { "A", "B", "X", "Y" }; for (int i = 0; i < 4; i++) if (others[i] == start) { others.erase(others.begin() + i); break; } string check; int count = 0; int digit = 1; string result; while (true) { check.clear(); for (int i = 0; i < 4; i++, count++) { check += start; digit = 1; for (int j = 0; j < N-1; digit*=3, j++) { check += others[count%(digit*3)/digit]; } } if (press(check) == N) { if (press(check.substr(0, 2 * N)) == N) { result = (press(check.substr(0, N)) == N ? check.substr(0, N) : check.substr(N, N)); } else { result = (press(check.substr(2 * N, N)) == N ? check.substr(2 * N, N) : check.substr(3 * N, N)); } break; } } return result; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:6: error: 'press' was not declared in this scope
   11 |  if (press("AB") == 1)
      |      ^~~~~
combo.cpp:42:7: error: 'press' was not declared in this scope
   42 |   if (press(check) == N)
      |       ^~~~~