제출 #862857

#제출 시각아이디문제언어결과실행 시간메모리
86285720163070콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; std::string guess_sequence(int N) { string f; string s; if(press("AB")) { if(press("A")) f="A",s="BXY"; else f="B",s="AXY"; } else { if(press("X")) f="X",s="ABY"; else f="Y",s="ABX"; } string ans; ans+=f; for(int i=2;i<n;i++) { string t=ans+s[0]+ans+s[1]+s[0]+ans+s[1]+s[1]+ans+s[1]+s[2]; int get=press(t); if(get==i-1) ans+=s[2]; else if(get==i) ans+=s[0]; else ans+=s[1]; } if(press(ans+s[0])==n) ans+=s[0]; else if(press(ans+s[1])==n) ans+=s[1]; else ans+=s[2]; return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:16: error: 'n' was not declared in this scope
   20 |  for(int i=2;i<n;i++)
      |                ^
combo.cpp:28:22: error: 'n' was not declared in this scope
   28 |  if(press(ans+s[0])==n) ans+=s[0];
      |                      ^