제출 #161139

#제출 시각아이디문제언어결과실행 시간메모리
161139InkretBear콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; string guess_sequence(int n){ int q=press("AB"),w=press("AX"); char s[4]={'A','B','X','Y'}; if (q && w){ swap(s[0],s[3]); } if (q && !w){ swap(s[1],s[3]); } if (!q && w){ swap(s[2],s[3]); } string res,u; res.push_back(s[3]); for (int i=1;i<n-1;++i){ u.clear(); for (int j=0;j<i;++j){ u.push_back(res[j]); } u.push_back(s[1]); for (int j=0;j<i;++j){ u.push_back(res[j]); } u.push_back(s[0]); u.push_back(s[0]); for (int j=0;j<i;++j){ u.push_back(res[j]); } u.push_back(s[0]); u.push_back(s[2]); for (int j=0;j<i;++j){ u.push_back(res[j]); } u.push_back(s[0]); u.push_back(s[1]); q=press(u); if (q==i){ res.push_back(s[2]); } if (q==i+1){ res.push_back(s[1]); } if (q==i+2){ res.push_back(s[0]); } } u.clear(); for (int i=0;i<n-1;++i){ u.push_back(res[i]); } u.push_back(s[0]); q=press(u); u.clear(); for (int i=0;i<n-1;++i){ u.push_back(res[i]); } u.push_back(s[1]); w=press(u); if (q==n){ res.push_back(s[0]); } else if (w==n){ res.push_back(s[1]); } else { res.push_back(s[2]); } return res; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:5:8: error: 'press' was not declared in this scope
    5 |  int q=press("AB"),w=press("AX");
      |        ^~~~~
combo.cpp:7:11: error: 'w' was not declared in this scope
    7 |  if (q && w){
      |           ^
combo.cpp:10:12: error: 'w' was not declared in this scope
   10 |  if (q && !w){
      |            ^
combo.cpp:13:12: error: 'w' was not declared in this scope
   13 |  if (!q && w){
      |            ^
combo.cpp:61:2: error: 'w' was not declared in this scope
   61 |  w=press(u);
      |  ^