제출 #706729

#제출 시각아이디문제언어결과실행 시간메모리
706729Yell0콤보 (IOI18_combo)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int MN=2e3+2; string guess_sequence(int N) { vector<char> ch={'A','B','X','Y'}; if(press("AB")) { if(press("B")) swap(ch[0],ch[1]); } else { if(press("X")) swap(ch[0],ch[2]); else swap(ch[0],ch[3]); } string ans=""; ans.push_back(ch[0]); for(int i=1;i<N;++i) { int r=press(ans+ch[1]+ans+ch[2]+ch[1]+ans+ch[2]+ch[2]+ans+ch[2]+ch[3]); if(r==i) ans.push_back(ch[3]); else if(r==i+1) ans.push_back(ch[1]); else ans.push_back(ch[2]); } if(press(ans+ch[1])==N) ans.push_back(ch[1]); else { if(press(ans+ch[2])==N) ans.push_back(ch[2]); else ans.push_back(ch[3]); } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:6: error: 'press' was not declared in this scope
    8 |   if(press("AB")) {
      |      ^~~~~
combo.cpp:17:11: error: 'press' was not declared in this scope
   17 |     int r=press(ans+ch[1]+ans+ch[2]+ch[1]+ans+ch[2]+ch[2]+ans+ch[2]+ch[3]);
      |           ^~~~~
combo.cpp:22:6: error: 'press' was not declared in this scope
   22 |   if(press(ans+ch[1])==N) ans.push_back(ch[1]);
      |      ^~~~~