제출 #1127503

#제출 시각아이디문제언어결과실행 시간메모리
1127503anuar콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; string guess_sequence(int N) { string p = ""; char f = 'A'; if (press("B") == 1) { f = 'B'; } else if (press("X") == 1) { f = 'X'; } else if (press("Y") == 1) { f = 'Y'; } string s1, s2, s3; s1 += f, s2 += f, s3 += f; if (N == 1) { return s1; } string s = "ABXY"; s.erase(s.find(f), 1); int cur = 1; while (s1.size() < N) { for (int i = 0; i < 3; i++) { s1 += s[i]; s2 += s[(i+1)%3]; s3 += s[(i+2)%3]; if (press(s1 + s2 + s3) == cur+1) { cur++; break; } s1.pop_back(); s2.pop_back(); s3.pop_back(); } } if (press(s1.substr(0, 2) + s2.substr(0, 2)) == 2) { if (press(s1.substr(0, 2)) == 2) return s1; else return s2; } else return s3; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:9: error: 'press' was not declared in this scope
    8 |     if (press("B") == 1) {
      |         ^~~~~
combo.cpp:33:17: error: 'press' was not declared in this scope
   33 |             if (press(s1 + s2 + s3) == cur+1) {
      |                 ^~~~~
combo.cpp:43:9: error: 'press' was not declared in this scope
   43 |     if (press(s1.substr(0, 2) + s2.substr(0, 2)) == 2) {
      |         ^~~~~
combo.cpp:47:1: warning: control reaches end of non-void function [-Wreturn-type]
   47 | }
      | ^