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"
//#include "grader.cpp"
using namespace std;
string s,f,g;
int i,j,p,q,n;
vector <char> letters;
void guess2(int tobe)
{
f = s;
s=s+'A'+s+'B';
p = press(s);
if(p>=tobe)
{
s = f+'A';
p = press(s);
if(p!=tobe)
s = f+'B';
}
else
{
s = f+'X';
p = press(s);
if(p!=tobe)
s = f+'Y';
}
}
string guess_sequence(int N)
{
s="";
n = N;
guess2(1);
if(s[0]!='A')
letters.push_back('A');
if(s[0]!='B')
letters.push_back('B');
if(s[0]!='X')
letters.push_back('X');
if(s[0]!='Y')
letters.push_back('Y');
for(i=2;i<n;i++)
{
f = s+letters[0];
g="";
for(auto j:letters)
g = g+s+letters[1]+j;
f = f+g;
p = press(f);
if(p==i)
s=s+letters[0];
else if(p==i+1)
s = s+letters[1];
else s = s+letters[2];
// cout<<s<<endl;
}
guess2(n);
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |