This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
* Author : boatinw99
* Date : 1.5.2019 11:54
**/
#include "combo.h"
#include<bits/stdc++.h>
using namespace std ;
set<char> s ;
char c[3];
string guess_sequence(int n)
{
string ans = "" ;
string p="AB";
int ret = press(p);
char root ;
if(ret>=1)
{
p="A";
ret = press(p);
if(ret==1)root='A';
else root='B';
}
else
{
p="X";
ret = press(p);
if(ret==1)root='X';
else root='Y';
}
s.insert('A');s.insert('B');s.insert('X');s.insert('Y');
ans=root;
s.erase(root);
int i = 0 ;
for(auto it:s)c[i++]=it;
for(int i=2;i<n;i++)
{
p=ans+c[0]+c[0]+ans+c[0]+c[1]+ans+c[0]+c[2]+ans+c[1];
int ret = press(p);
if(ret==i+1)ans+=c[0];
else if(ret==i)ans+=c[1];
else ans+=c[2];
}
p = ans+c[0]+ans+c[1];
ret = press(p);
if(ret==n)
{
p = ans+c[0];
ret = press(p);
if(ret==n)ans+=c[0];
else ans+=c[1];
}
else ans+=c[2];
return ans ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |