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;
std::string guess_sequence(int N) {
int a = press("AB");
string p = "";
if (a) {
a = press("A");
if (a) {
p += 'A';
} else {
p += 'B';
}
} else {
a = press("X");
if (a) {
p += 'X';
} else {
p += 'Y';
}
}
if (1 == N) {
return p;
}
vector <char> chr = {'A','B','X','Y'};
chr.erase(find(begin(chr),end(chr),p[0]));
while ((int)p.size()<N-1) {
a = press(p + chr[0] + p + chr[1] + chr[0] + p + chr[1] + chr[2] + p + chr[1] + chr[1]);
if ((int)p.size() == a) {
p += chr[2];
} else if ((int)p.size()+1 == a) {
p += chr[0];
} else {
p += chr[1];
}
}
a = press(p+chr[0]+p+chr[1]);
if (a==N) {
a = press(p+chr[0]);
if(a==N) {
p += chr[0];
}else{
p += chr[1];
}
} else {
p += chr[2];
}
// cout <<p<<'\n';
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |