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<bits/stdc++.h>
#include"combo.h"
using namespace std;
// press(string) -> int
string guess_sequence(int N)
{
string s = (press("AB")?(press("A")?"A":"B"):(press("X")?"X":"Y"));
string q;
if(N==1) return s;
for(char i : "ABXY")
if(i!=s[0]) q+=i;
///cerr<<q<<endl;
for(int i=2;i<=N-1;i++)
{
int x = press(s+q[1]+s+q[2]+q[0]+s+q[2]+q[1]+s+q[2]+q[2]);
s+=q[x-s.size()];
}
if(press(s+q[0]) == N) s+=q[0];
else if(press(s+q[1]) == N) s+=q[1];
else s+=q[2];
//cerr<<s<<endl;
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |