# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1217967 | islam_2010 | 콤보 (IOI18_combo) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
int press(string s);
string guess_sequence(int n) {
string s;
if(press("AB")){
if(press("A")){
s = 'A';
string a[4] = {"BB", "BX", "BY", "X"};
}else {
s='B';
string a[4] = {"AA", "AX", "AY", "B"};
}
}else {
if(press("X")){
s = 'X';
string a[4] = {"BB", "BX", "BY", "X"};
}else {
s = 'Y';
string a[4] = {"BB", "BX", "BY", "X"};
}
}if(n==1){
return s;
}
for(int i = 1; i < n-1; i++){
if(s[0]=='A'){
string ns = s+a[0]+s+a[1]+s+a[2]+s+a[3];
int x = press(ns);
if(x==s.size()){
s+='Y';
}else if(x == s.size()+1){
s+='X';
}else {
s+='B';
}
}
}return s;
}