제출 #310845

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

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:30: error: 'c' was not declared in this scope
   13 |   string cur = ans+b+b + ans+c + ans+b+c + ans+b+d;
      |                              ^
combo.cpp:13:50: error: 'd' was not declared in this scope
   13 |   string cur = ans+b+b + ans+c + ans+b+c + ans+b+d;
      |                                                  ^
combo.cpp:20:20: error: 'c' was not declared in this scope
   20 |  else if(press(ans+c)==N) ans+=c;
      |                    ^
combo.cpp:21:12: error: 'd' was not declared in this scope
   21 |  else ans+=d;
      |            ^