# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
873621 | maxFedorchuk | Combo (IOI18_combo) | C++14 | 15 ms | 2120 KiB |
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;
/*
int press(string p)
{
cout<<p<<endl;
cout.flush();
int rt;
cin>>rt;
return rt;
}
*/
string guess_sequence(int N)
{
string alsym[4]={"A","B","X","Y"};
string pot[3];
int frs;
if(press(alsym[0]+alsym[1]))
{
if(press(alsym[0]))
{
frs=0;
pot[0]="B";
pot[1]="X";
pot[2]="Y";
}
else
{
frs=1;
pot[0]="A";
pot[1]="X";
pot[2]="Y";
}
}
else
{
if(press(alsym[2]))
{
frs=2;
pot[0]="A";
pot[1]="B";
pot[2]="Y";
}
else
{
frs=3;
pot[0]="A";
pot[1]="B";
pot[2]="X";
}
}
string res=alsym[frs];
if(N==1)
{
return res;
}
for(int i=2;i<N;i++)
{
string zap=(res+pot[0]+pot[0])+(res+pot[0]+pot[1])+(res+pot[0]+pot[2])+(res+pot[1]+alsym[frs]);
int rt=press(zap);
if((res.size()+2)==rt)
{
res=res+pot[0];
}
else
{
if((res.size()+1)==rt)
{
res=res+pot[1];
}
else
{
res=res+pot[2];
}
}
}
if(press(res+pot[0]+res+pot[1])==N)
{
if(press(res+pot[0])==N)
{
res=res+pot[0];
}
else
{
res=res+pot[1];
}
}
else
{
res=res+pot[2];
}
return res;
}
/*
int main()
{
cin.tie(0);
ios_base::sync_with_stdio(0);
string s;
cin>>s;
if(guess_sequence(s.size())==s)
{
cout<<"Ok\n";
}
else
{
cout<<"No\n";
}
return 0;
}
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |