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;
#define pb push_back
int guess(string s){ return press(s);}
string guess_sequence(int n)
{
string ret;
if(guess("AB"))
{
if(guess("A")) ret='A';
else ret='B';
}
else if(guess("X")) ret='X';
else ret='Y';
vector<char> ch;
if("A"!=ret) ch.pb('A');
if("B"!=ret) ch.pb('B');
if("X"!=ret) ch.pb('X');
if("Y"!=ret) ch.pb('Y');
for(int i=2;i<=n;i++)
{
if(i==n)
{
if(guess(ret+ch[0])==i) ret+=ch[0];
else if(guess(ret+ch[1])==i) ret+=ch[1];
else ret+=ch[2];
continue;
}
string tmp=ret+ch[0]+ret+ch[1]+ch[0]+ret+ch[1]+ch[1]+ret+ch[1]+ch[2];
int x=guess(tmp);
if(x==i) ret+=ch[0];
else if(x==i+1) ret+=ch[1];
else ret+=ch[2];
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |