제출 #309630

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

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:8: error: 'press' was not declared in this scope
    7 |     if(press("AB")){
      |        ^~~~~
combo.cpp:27:19: error: 'press' was not declared in this scope
   27 |         int chu = press(ans+a+ans+b+a+ans+b+b+ans+b+c);
      |                   ^~~~~
combo.cpp:36:12: error: 'press' was not declared in this scope
   36 |         if(press(ans+a)==n)
      |            ^~~~~
combo.cpp:44:1: warning: control reaches end of non-void function [-Wreturn-type]
   44 | }
      | ^