제출 #401876

#제출 시각아이디문제언어결과실행 시간메모리
401876hibye1217콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; string guess_sequence(int N){ string ans = ""; int res = press("AB"); if (res >= 1){ res = press("A"); if (res == 1){ ans += "A"; } else{ ans += "B"; } } else{ res = press("X"); if (res == 1){ ans += "X"; } else{ ans += "Y"; } } char c1, c2, c3; if (ans[0] == 'A'){ c1 = 'B'; c2 = 'X'; c3 = 'Y'; } if (ans[0] == 'B'){ c1 = 'A'; c2 = 'X'; c3 = 'Y'; } if (ans[0] == 'X'){ c1 = 'A'; c2 = 'B'; c3 = 'Y'; } if (ans[0] == 'Y'){ c1 = 'A'; c2 = 'B'; c3 = 'X'; } for (int i = 2; i < N; i++){ res = press(ans+c1+c1 + ans+c1+c2 + ans+c1+c3 + ans+c2); if (res > i){ ans += c1; } if (res == i){ ans += c2; } if (res < i){ ans += c3; } } res = press(ans+c1); if (res == N){ return ans+c1; } res = press(ans+c2); if (res == N){ return ans+c2; } else{ return ans+c3; } }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:5:12: error: 'press' was not declared in this scope; did you mean 'res'?
    5 |  int res = press("AB");
      |            ^~~~~
      |            res