제출 #1218063

#제출 시각아이디문제언어결과실행 시간메모리
1218063islam_2010Combo (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string res=""; if(press("AB")){ if(press("A")){ res = "A"; }else { res = "B"; } }else { if(press("X")){ res = "X"; }else { res = "Y"; } }if(n==1){ return res; } string s = "ABXY"; string c; int p = 1; for(auto i: s){ if(i!=res[0]){ c+=i; } }for(int i = 1; i + 1 < N; i++){ string ns = res+c[0]+res+c[1]+c[0]+res+c[1]+c[1]+res+c[1]+c[2]; int x = press(ns); if(x==p){ res+=c[2]; }else if(x==p+1){ res+=c[0]; }else { res += c[1]; } p++; }for(auto i: c){ if(press(res+i)==p+1){ res+=i; break; } }return res; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:9: error: 'n' was not declared in this scope
   20 |     }if(n==1){
      |         ^