This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define fto(i, a, b) for (int i = a; i <= b; ++i)
using namespace std;
int n;
int press(string p);
string guess_sequence(int n){
string G, hoho, haha, haha1, haha2, haha3, hehe;
int trai = press("AB"), phai = press("XA");
if (trai == phai){
G = "A";
} else
if (trai > phai){
G = "B";
} else
if (trai < phai){
G = "X";
} else G = "Y";
if (G == "A"){
hoho = "B";
haha = "X";
haha1 = "XB";
haha2 = "XX";
haha3 = "XY";
hehe = "Y";
}
if (G == "B"){
hoho = "A";
haha = "X";
haha1 = "XA";
haha2 = "XX";
haha3 = "XY";
hehe = "Y";
}
if (G == "X"){
hoho = "A";
haha = "B";
haha1 = "BA";
haha2 = "BB";
haha3 = "BY";
hehe = "Y";
}
if (G == "Y"){
hoho = "A";
haha = "B";
haha1 = "BA";
haha2 = "BB";
haha3 = "BX";
hehe = "X";
}
fto(i, 2, n-1){
string tmp = G + hoho + G + haha1 + G + haha2 + G + haha3;
int get = press(tmp), sz = G.size();
if (get == sz + 1){
G = G + hoho;
} else
if (get == sz + 2){
G = G + haha;
} else G = G + hehe;
//cout << G << endl;
}
string l = G + hoho + G + hehe, r = G + haha + G + hoho;
trai = press(l), phai = press(r);
if (trai == phai){
G = G + hoho;
} else
if (trai > phai){
G = G + hehe;
} else G = G + haha;
return G;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |