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 = "";
int ask=press("AB");
if(ask>0){
ask=press("A");
if(ask==1)p="A";
else p="B";
}
else{
ask=press("X");
if(ask==1)p="X";
else p="Y";
}
if(N==1)return p;
vector<string> bukan;
if("A"!=p)bukan.push_back("A");
if("B"!=p)bukan.push_back("B");
if("X"!=p)bukan.push_back("X");
if("Y"!=p)bukan.push_back("Y");
for(int i=2;i<=N-1;i++){
string tebak=p+bukan[1];
for(int j=0;j<3;j++)tebak=tebak+p+bukan[2]+bukan[j];
ask=press(tebak);
if(ask==i-1)p=p+bukan[0];
else if(ask==i)p=p+bukan[1];
else p=p+bukan[2];
}
bool ada=false;
for(int i=0;i<2;i++){
ask=press(p+bukan[i]);
if(ask==N){
p=p+bukan[i];
ada=true;
break;
}
}
if(!ada)p=p+bukan[2];
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |