제출 #899560

#제출 시각아이디문제언어결과실행 시간메모리
899560SuPythony콤보 (IOI18_combo)C++17
100 / 100
14 ms1956 KiB
#include <bits/stdc++.h> int press(std::string p); std::string guess_sequence(int n) { std::string ans=""; if (press("AB")) { if (press("A")) ans="A"; else ans="B"; } else { if (press("X")) ans="X"; else ans="Y"; } std::string f=ans; int l=1; while (l<n-1) { if (f=="A") { int a=press(ans+"B"+ans+"XB"+ans+"XX"+ans+"XY"); if (a==l) ans+="Y"; else if (a==l+1) ans+="B"; else ans+="X"; } else if (f=="B") { int a=press(ans+"A"+ans+"XA"+ans+"XX"+ans+"XY"); if (a==l) ans+="Y"; else if (a==l+1) ans+="A"; else ans+="X"; } else if (f=="X") { int a=press(ans+"B"+ans+"AB"+ans+"AA"+ans+"AY"); if (a==l) ans+="Y"; else if (a==l+1) ans+="B"; else ans+="A"; } else { int a=press(ans+"B"+ans+"XB"+ans+"XX"+ans+"XA"); if (a==l) ans+="A"; else if (a==l+1) ans+="B"; else ans+="X"; } l++; } if (n>1) { if (press(ans+"A"+ans+"B")>l) { if (press(ans+"A")>l) ans+="A"; else ans+="B"; } else { if (press(ans+"X")>l) ans+="X"; else ans+="Y"; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...