# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1221268 | hmms127 | Combo (IOI18_combo) | C++20 | 0 ms | 0 KiB |
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<stack>
using namespace std;
const int mod=1e9+7;
string guess_sequence(int N);
int press(string s);
string l;
string guess_sequence(int N) {
string z;
if(press("AB")) {
if(press("A")) {
z+='A';
l="BXY";
}
else {
z+='B';
l="AXY";
}
}
else {
if(press("X")) {
z+='X';
l="ABY";
}
else {
z+='Y';
l="ABX";
}
}
while(z.size()<N-1) {
int cnt=press(z+l[0]+l[0]+z+l[0]+l[1]+z+l[0]+l[2]+z+l[1]);
if(cnt==i) {
z+=l[2];
}
else if(cnt==i+1) {
z+=l[1];
}
else {
z+=l[0];
}
}
if(z.size()==N-1) {
if(press(z+l[0])) {
z+=l[0];
}
else if(press(z+l[1])) {
z+=l[1];
}
else {
z+=l[2];
}
}
return z;
}