제출 #1128604

#제출 시각아이디문제언어결과실행 시간메모리
1128604Mathias콤보 (IOI18_combo)C++20
0 / 100
0 ms408 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string p="", ans=""; int x; p="AB"; x=press(p); if(x==0){ p="X", x=press(p); if(x==0) ans="Y"; else ans="X"; } else{ p="A", x=press(p); if(x==0) ans="B"; else ans="A"; } for(int i=2;i<=N-2;i++){ if(ans[0]=='A'){ p=ans+"B"+ans+"XY"+ans+"XX"+ans+"XB", x=press(p); if(x==0) ans+="Y"; else if(x==1) ans+="B"; else ans+="X"; } else if(ans[0]=='X'){ p=ans+"B"+ans+"AY"+ans+"AB"+ans+"AA", x=press(p); if(x==0) ans+="Y"; else if(x==1) ans+="B"; else ans+="A"; } else if(ans[0]=='B'){ p=ans+"Y"+ans+"XY"+ans+"XX"+ans+"XB", x=press(p); if(x==0) ans+="A"; else if(x==1) ans+="Y"; else ans+="X"; } else if(ans[0]=='Y'){ p=ans+"B"+ans+"XA"+ans+"XX"+ans+"XB", x=press(p); if(x==0) ans+="A"; else if(x==1) ans+="B"; else ans+="X"; } } p=ans+"A"+ans+"B"; x=press(p); if(x==ans.size()){ p=ans+"X", x=press(p); if(x==ans.size()) ans+="Y"; else ans+="X"; } else{ p=ans+"A", x=press(p); if(x==ans.size()) ans+="B"; else ans+="A"; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...