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;
string stor = "ABXY";
int press(string p);
////#ifdef LOCALME
//int press(string p){
// int nana;
// cout << p << endl;
// cin >> nana;
// return nana;
//}
////#endif // LOCALME
string guess_sequence(int n){
string G, hoho, haha, haha1, haha2, haha3, hehe;
int trai = press("ABABXBY"), phai = press("XYAYBYX");
if (trai){
if (trai == 1){
G = "A";
hoho = "B";
haha1 = "XB";
hehe = "Y";
} else{
G = "B";
hoho = "A";
haha1 = "XA";
hehe = "Y";
}
haha = "X";
haha2 = "XX";
haha3 = "XY";
hehe = "Y";
} else {
if (phai == 1){
G = "X";
haha3 = "BY";
hehe = "Y";
} else{
G = "Y";
haha3 = "BX";
hehe = "X";
}
hoho = "A";
haha = "B";
haha1 = "BA";
haha2 = "BB";
}
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;
}
//int main() {
// int n; cin >> n;
// cout << guess_sequence(n) << endl;
// return 0;
//}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |