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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int n) {
string p = "ABXY", ans, t;
if(press("AB") > 0) {
if(press("A")) {
ans += 'A';
} else {
ans += 'B';
}
} else{
if(press("X")) {
ans += 'X';
} else {
ans += 'Y';
}
}
for(int i = 0; i < 4; ++i) {
if(p[i] != ans[0]) t += p[i];
}
for(int i = 2; i < n; ++i) {
string s0 = ans + t[0];
string s1 = ans + t[1] + t[0];
string s2 = ans + t[1] + t[1];
string s3 = ans + t[1] + t[2];
int x = press(s0 + s1 + s2 + s3);
if(x == i - 1) {
ans += t[2];
} else {
if(x == i) {
ans += t[0];
} else {
ans += t[1];
}
}
}
string s0 = ans + t[0];
string s1 = ans + t[1];
string s2 = ans + t[2];
int x = press(s0 + s1);
if(x == n) {
if(press(s0) == n) {
ans += t[0];
} else {
ans += t[1];
}
} else {
ans += t[2];
}
cout << ans << endl;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |