제출 #599895

#제출 시각아이디문제언어결과실행 시간메모리
599895Hanksburger콤보 (IOI18_combo)C++17
100 / 100
33 ms584 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string ans, s[3]; char c[3]; string guess_sequence(int n) { if (press("AB")) { if (press("A")) { ans.push_back('A'); c[0]='B'; c[1]='X'; c[2]='Y'; s[0]="B"; s[1]="X"; s[2]="Y"; } else { ans.push_back('B'); c[0]='A'; c[1]='X'; c[2]='Y'; s[0]="A"; s[1]="X"; s[2]="Y"; } } else { if (press("X")) { ans.push_back('X'); c[0]='A'; c[1]='B'; c[2]='Y'; s[0]="A"; s[1]="B"; s[2]="Y"; } else { ans.push_back('Y'); c[0]='A'; c[1]='B'; c[2]='X'; s[0]="A"; s[1]="B"; s[2]="X"; } } for (int i=1; i<=n-2; i++) { int res=press(ans+s[0]+s[0]+ans+s[0]+s[1]+ans+s[0]+s[2]+ans+s[1]); if (res==i) ans.push_back(c[2]); else if (res==i+1) ans.push_back(c[1]); else ans.push_back(c[0]); } if (n>=2) { if (press(ans+s[0])==n) ans.push_back(c[0]); else if (press(ans+s[1])==n) ans.push_back(c[1]); else ans.push_back(c[2]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...