이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 (n == 1){
return G;
}
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... |