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 "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
vector<char> go = {'A','B','X','Y'};
std::string guess_sequence(int N) {
std::string p = "";
vector<char> v;
if(press("AB")){
if(press("A")==1)p="A";
else p = "B";
} else {
if(press("X") == 1)p = "X";
else p = "Y";
}
if(N==1)return p;
go.erase(find(go.begin(),go.end(),p[0]));
for(int i = 2; i < N; i++){
int x = press(p + go[0] + go[0] + p + go[0] + go[1] + p + go[0] + go[2] + p + go[1]);
if(x == i + 1)p.push_back(go[0]);
else if(x == i)p.push_back(go[1]);
else if(x == i - 1)p.push_back(go[2]);
}
if(press(p + go[0]) == N)p.push_back(go[0]);
else if(press(p + go[1]) == N)p.push_back(go[1]);
else p.push_back(go[2]);
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |