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 <iostream>
#include <string>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string S = "";
string s1 = "";
string s2 = "";
string s3 = "";
string s4 = "";
if (press("AB") > 0) {
if (press("B") > 0) {
S[0] = 'B';
s1 = "XA";
}
else {
S[0] = 'A';
s1 = "XB";
}
s2 = "XY";
s3 = "XX";
s4 = "Y";
}
else {
if (press("X") > 0) {
S[0] = 'X';
s1 = "AY";
}
else {
S[0] = 'Y';
s1 = "AX";
}
s2 = "AB";
s3 = "AA";
s4 = "B";
}
int cnt = 1;
for(int i=1;i<N-1;++i) {
int c = press(S + s1 + S + s2 + S + s3 + S + s4);
if (c - cnt == 2) S += s1[0];
else if (c - cnt == 1) S += s4[0];
cnt++;
}
if (press(S + 'A' + S + 'B') > cnt) {
if (press(S + 'A') > cnt) {
S += 'A';
return S;
}
else {
S += 'B';
return S;
}
}
else {
if (press(S + "X") > cnt) {
S += 'X';
return S;
}
else {
S += 'Y';
return S;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |