제출 #1286019

#제출 시각아이디문제언어결과실행 시간메모리
1286019sopaipilla콤보 (IOI18_combo)C++20
97 / 100
8 ms480 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n) { if(n==1) { if(press("A")) return "A"; if(press("B")) return "B"; if(press("X")) return "X"; if(press("Y")) return "Y"; } string pfx=""; array<char,3> rst; if(press("AB")) { if(press("A")) pfx="A", rst={'B','X','Y'}; else pfx="B", rst={'A','X','Y'}; } else { if(press("X")) pfx="X", rst={'A','B','Y'}; else pfx="Y", rst={'A','B','X'}; } for(int i=2; i<n; ++i) { int ans = press( pfx+rst[0] +pfx+rst[1]+rst[0] +pfx+rst[1]+rst[1] +pfx+rst[1]+rst[2] ); if(ans==pfx.size()) pfx+=rst[2]; else if(ans==pfx.size()+1) pfx+=rst[0]; else pfx+=rst[1]; } for(int k=0; k<3; ++k) if(press(pfx+rst[k])==n) return pfx+rst[k]; return ""; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...