제출 #503698

#제출 시각아이디문제언어결과실행 시간메모리
503698cristi_a콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <string.h> using namespace std; string guess_sequence(int N) { char lets[4]; strcpy(lets,"ABXY"); string rez = ""; if(press("AB")) rez = press("A") ? "A" : "B"; else rez = press("X") ? "X" : "Y"; for(int i=0; i<4; i++) if(lets[i]==rez[0]) { strcpy(lets+i,lets+i+1); break; } for(int i=1; i<N; i++) { if(i==N-1) { if(press(rez+lets[0])==N) rez = rez + lets[0]; else if(press(rez+lets[1])==N) rez = rez + lets[1]; else rez = rez + lets[2]; } else { string temp = rez + lets[1] + rez + lets[0] + lets[0] + rez + lets[0] + lets[1] + rez + lets[0] + lets[2]; int w = press(temp); if(w == i+1) rez = rez + lets[1]; else if(w==i+2) rez = rez + lets[0]; else rez = rez + lets[2]; } } return rez; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:8: error: 'press' was not declared in this scope
    9 |     if(press("AB")) rez = press("A") ? "A" : "B";
      |        ^~~~~
combo.cpp:20:16: error: 'press' was not declared in this scope
   20 |             if(press(rez+lets[0])==N) rez = rez + lets[0];
      |                ^~~~~
combo.cpp:26:21: error: 'press' was not declared in this scope
   26 |             int w = press(temp);
      |                     ^~~~~