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>
#define watch(x) cerr<<#x<<": "<<(x)<<endl
#include "combo.h"
using namespace std;
char getFirst() {
if (press("AB") >= 1) {
return press("A")==1 ? 'A' : 'B';
} else {
return press("X")==1 ? 'X' : 'Y';
}
}
string valid = "ABXY";
string guess_sequence(int N) {
string p,S;
char first = getFirst();
S.push_back(first);
watch(first);
for (int i=2; i<=N; i++) {
for (char c : valid) {
if (c != first) {
if (press(S+c) == i) {
S.push_back(c);
break;
}
}
}
}
watch(S);
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |