제출 #1286032

#제출 시각아이디문제언어결과실행 시간메모리
1286032sopaipilla콤보 (IOI18_combo)C++20
100 / 100
8 ms480 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n) { 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'}; } if(n==1) return pfx; 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]; } if(press(pfx+rst[0])==n) return pfx+rst[0]; if(press(pfx+rst[1])==n) return pfx+rst[1]; return pfx+rst[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...