제출 #75796

#제출 시각아이디문제언어결과실행 시간메모리
75796chunghan콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include<iostream> #include<string> #include<vector> using namespace std; vector<string> str; string guess_sequence(int N) { string p = ""; str.push_back("A"); str.push_back("B"); str.push_back("X"); str.push_back("Y"); int a = press("AB"), b = press("AX"); if((a > 0) && (b > 0)) { p += "A"; str.erase(str.begin()); } else if(a > 0) { p += "B"; str.erase(str.begin()+1); } else if(b > 0){ p += "X"; str.erase(str.begin()+2); } else { p += "Y"; str.erase(str.begin()+3); } for(int i = 0; i < N-2; i++) { string tmp = p + str[0] + str[0] + p + str[0] + str[1] + p + str[0] + str[2] + p + str[1]; int k = press(tmp); if(k == i+2) p += str[0]; else if(k == i+1) p += str[1]; else p += str[2]; } a = press(p+str[0]); b = press(p+str[1]); if(a == N) p += str[0]; else if(b == N) p += str[1]; else p += str[2]; return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:15:11: error: 'press' was not declared in this scope
   15 |   int a = press("AB"), b = press("AX");
      |           ^~~~~
combo.cpp:16:18: error: 'b' was not declared in this scope
   16 |   if((a > 0) && (b > 0)) {
      |                  ^
combo.cpp:37:3: error: 'b' was not declared in this scope
   37 |   b = press(p+str[1]);
      |   ^