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 ll long long
#define pb push_back
string ch[] = {"A" , "B" , "X" , "Y"};
string guess_sequence(int n)
{
string p;
if(press(ch[0] + ch[1]))
{
if(!press(ch[0]))
swap(ch[0] , ch[1]);
}
else
{
if(press(ch[2]))
swap(ch[2] , ch[0]);
else
swap(ch[3] , ch[0]);
}
p = ch[0];
for(int i = 1; i < n - 1; i++)
{
string tmp = p + ch[1] + p + ch[2] + ch[1] + p + ch[2] + ch[2] + p + ch[2] + ch[3];
int x = press(tmp);
if(x == (int)p.size())
p += ch[3];
else if(x == (int)p.size() + 1)
p += ch[1];
else
p += ch[2];
}
if(n == 1)
return p;
if(press(p + ch[1]) == n)
p += ch[1];
else
{
if(press(p + ch[2]) == n)
p += ch[2];
else
p += ch[3];
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |