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 <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
int press(std::string p);
std::string guess_sequence(int N) {
string curr;
if(press("AB")){
if(press("A"))curr="A";
else curr="B";
} else {
if(press("X"))curr="X";
else curr="Y";
}
vector<string> options;
if(curr[0]!='A')options.emplace_back("A");
if(curr[0]!='B')options.emplace_back("B");
if(curr[0]!='X')options.emplace_back("X");
if(curr[0]!='Y')options.emplace_back("Y");
for(int i=2;i<N;i++){
auto ans = press(curr+options[1]+curr+options[2]+options[0]+curr+options[2]+options[1]+curr+options[2]+options[2]);
if(ans==i)curr+=options[1];
else if(ans==(i+1))curr+=options[2];
else curr+=options[0];
}
if(N==1)return curr;
if(press(curr+options[0])==N)curr+=options[0];
else if(press(curr+options[1])==N)curr+=options[1];
else curr+=options[2];
return curr;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |