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) {
/*std::string p = "";
for (int i = 0; i < 4 * N; ++i) {
p += 'A';
}
int coins = press(p);
std::string S = "";
for (int i = 0; i < N; ++i) {
S += 'A';
}*/
string s="";
vector<string> sta;
if(press("AB")!=0)
{
if(press("A")==1) s+="A";
else s+="B";
}
else
{
if(press("X")==1) s+="X";
else s+="Y";
}
//cout<<s<<endl;
if(s!="A") sta.push_back("A");
if(s!="B") sta.push_back("B");
if(s!="X") sta.push_back("X");
if(s!="Y") sta.push_back("Y");
//for(int i=0;i<3;i++) cout<<sta[i]<<endl;
for(int i=1;i<n-1;i++)
{
string kveri="";
kveri+=s;
kveri+=sta[0];
string wt="";
for(int i=0;i<3;i++)
{
wt+=kveri;
wt+=sta[i];
}
wt+=s;
wt+=sta[1];
int odg=press(wt);
if(odg==i) s+=sta[2];
else if(odg==i+1) s+=sta[1];
else s+=sta[0];
//cout<<s<<endl;
}
//cout<<s<<endl;
if(n==1) return s;
if(press(s+sta[0])==n) return s+sta[0];
else if(press(s+sta[1])==n) return s+sta[1];
return s+sta[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |