제출 #742255

#제출 시각아이디문제언어결과실행 시간메모리
742255Osplei콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" using namespace std; string guess_sequence(int N) { string p = ""; p="AB"; int coins = press(p); if (coins!=0) { p="A"; coins = press(p); if (coins==0) p="B"; } else { p="X"; coins = press(p); if (coins==0) p="Y"; } string S = p; if (p=="A"){ while ((int) S.size()!=N-1){ p=S; p+='B'; p+=S; p+="XX"; p+=S; p+="XB"; p+=S; p+="XY"; coins = press(p); if (coins == (int) S.size()) S+='Y'; else if (coins == (int) S.size()+1) S+='B'; else S+='X'; } p=S; p+='B'; coins = press(p); if (coins == N) S+='B'; else { p=S; p+='X'; coins = press(p); if (coins == N) S+='X'; else S+='Y'; } } else if (p=="B"){ while ((int) S.size()!=N-1){ p=S; p+='A'; p+=S; p+="XX"; p+=S; p+="XA"; p+=S; p+="XY"; coins = press(p); if (coins == (int) S.size()) S+='Y'; else if (coins == (int) S.size()+1) S+='A'; else S+='X'; } p=S; p+='A'; coins = press(p); if (coins == N) S+='A'; else { p=S; p+='X'; coins = press(p); if (coins == N) S+='X'; else S+='Y'; } } else if (p=="X"){ while ((int) S.size()!=n-1){ p=S; p+='B'; p+=S; p+="AA"; p+=S; p+="AB"; p+=S; p+="AY"; coins = press(p); if (coins == (int) S.size()) S+='Y'; else if (coins == (int) S.size()+1) S+='B'; else S+='A'; } p=S; p+='B'; coins = press(p); if (coins == N) S+='B'; else { p=S; p+='A'; coins = press(p); if (coins == N) S+='A'; else S+='Y'; } } else { while ((int) S.size()!=n-1){ p=S; p+='B'; p+=S; p+="XX"; p+=S; p+="XB"; p+=S; p+="XA"; coins = press(p); if (coins == (int) S.size()) S+='A'; else if (coins == (int) S.size()+1) S+='B'; else S+='X'; } p=S; p+='B'; coins = press(p); if (coins == N) S+='B'; else { p=S; p+='X'; coins = press(p); if (coins == N) S+='X'; else S+='A'; } } return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:93:28: error: 'n' was not declared in this scope
   93 |     while ((int) S.size()!=n-1){
      |                            ^
combo.cpp:126:28: error: 'n' was not declared in this scope
  126 |     while ((int) S.size()!=n-1){
      |                            ^