제출 #1311197

#제출 시각아이디문제언어결과실행 시간메모리
1311197gvancak콤보 (IOI18_combo)C++20
100 / 100
8 ms476 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { int ok=0; ok=press("AB"); string s=""; if (ok>=1){ if (ok==2) s="A"; else{ ok=press("A"); if (ok==1) s="A"; else s="B"; } } else{ ok=press("X"); if (ok==1) s="X"; else s="Y"; } string st="ABXY"; string p=""; for (int i=0; i<4; i++){ if (st[i]!=s[0]) p+=st[i]; } int k=1; while (k<N-1){ st=s; st+=p[0]; st+=s+p[1]+p[0]; st+=s+p[1]+p[1]; st+=s+p[1]+p[2]; ok=press(st); if (ok==k){ k++; s+=p[2]; continue; } if (ok==k+1){ k++; s+=p[0]; continue; } k++; s+=p[1]; } if (k==N-1){ st=s+p[0]; ok=press(st); if (ok==N) s=st; else{ st=s+p[1]; ok=press(st); if (ok==N) s=st; else s+=p[2]; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...