This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
* Prof.Nicola
**/
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
vector<string>v;
long n;
string ans;
void solve(long x)
{
string t;
long z;
if(x<n-1){
t=ans;
t+=v[0];
t+=v[0];
t+=ans;
t+=v[0];
t+=v[1];
t+=ans;
t+=v[0];
t+=v[2];
t+=ans;
t+=v[1];
z=press(t);
z-=x;
ans+=v[2-z];
solve(x+1);
}
else{
t=ans+v[0];
if(press(t)-x){
ans+=v[0];
}
else{
t=ans+v[1];
if(press(t)-x){
ans+=v[1];
}
else{
ans+=v[2];
}
}
return;
}
}
void rem(string s)
{
for(long i=0;i<4;i++){
if(v[i]==s){
v.erase(v.begin()+i);
return;
}
}
}
std::string guess_sequence(int N) {
n=N;
v.push_back("A");
v.push_back("B");
v.push_back("X");
v.push_back("Y");
if(N==1){
string s="A";
if(press(s)){
return s;
}
s="B";
if(press(s)){
return s;
}
s="X";
if(press(s)){
return s;
}
s="Y";
return s;
}
else{
string s="AB";
long x;
x=press(s);
if(x==1){
s="A";
if(press(s)){
ans+="A";
}
else{
ans+="B";
}
}
else{
s="X";
if(press(s)){
ans+="X";
}
else{
ans+="Y";
}
}
rem(ans);
solve(1);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |