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;
typedef long long ll;
#define pb push_back
#define F first
#define S second
#define enter cout<<'\n';
#define INF 99999999999999999
#define MOD 1000000007
#define all(x) x.begin(),x.end()
string guess_sequence(int N)
{
string dic[4]={"A","B","X","Y"};
ll first=-1;
string p;
for(int j=0;j<2*N;j++)
p+=dic[0][0];
for(int j=0;j<2*N;j++)
p+=dic[1][0];
ll ans=press(p);
pair<int,int>possible;
if(ans)
{
p="";
for(int j=0;j<4*N;j++)
p+=dic[0][0];
ans=press(p);
if(ans)
first=0;
else
first=1;
}
else
{
p="";
for(int j=0;j<4*N;j++)
p+=dic[2][0];
ans=press(p);
if(ans)
first=2;
else
first=3;
}
p="";
for(int i=0;i<4*N;i++)
p+=dic[first][0];
for(int i=1;i<N-1;i++)
{
p[i]=dic[(first+1)%4][0];
for(int j=1;j<=3;j++)
{
p[i+j*N]=dic[(first+2)%4][0];
p[i+j*N+1]=dic[(first+j)%4][0];
}
ans=press(p);
if(ans==i+1)
for(int j=0;j<=3;j++)
p[i+j*N]=dic[(first+1)%4][0];
if(ans==i+2)
for(int j=0;j<=3;j++)
p[i+j*N]=dic[(first+2)%4][0];
if(ans==i)
for(int j=0;j<=3;j++)
p[i+j*N]=dic[(first+3)%4][0];
}
if(N!=1)
{
for(int j=0;j<=3;j++)
p[N-1+j*N]=dic[(first+1)%4][0];
ans=press(p);
if(ans!=N)
{
p[N-1]=dic[(first+2)%4][0];
ans=press(p);
if(ans!=N)
p[N-1]=dic[(first+3)%4][0];
}
}
string answ;
for(int i=0;i<N;i++)
answ+=p[i];
// cout<<answ<<' ';
return answ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |