# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
644841 | tigar | Combo (IOI18_combo) | C++14 | 0 ms | 0 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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N)
{
string rezz="";
char slova[]={'A', 'B', 'X', 'Y'};
int begg=0;
if(press("AB")>=1)
{
if(press("A")==1){rezz+="A"; begg=0;}
else {rezz+="B"; begg=1;}
}
else
{
if(br==press("X")){rezz+="X"; begg=2;}
else {rezz+="Y"; begg=3;}
}
for(int i=1; i<N-1; i++)
{
string prs=rezz+slova[(begg+1)%4]+slova[(begg+1)%4];
prs+=rezz+slova[(begg+1)%4]+slova[(begg+2)%4];
prs+=rezz+slova[(begg+1)%4]+slova[(begg+3)%4];
prs+=rezz+slova[(begg+2)%4];
int lnght=press(prs);
if(lnght==i+2)rezz+=slova[(begg+1)%4];
else if(lnght==i+1)rezz+=slova[(begg+2)%4];
else rezz+=slova[(begg+3)%4];
}
if(press(rezz+slova[(begg+1)%4])==N)return rezz+slova[(begg+1)%4];
else if(press(rezz+slova[(begg+2)%4])==N)return rezz+slova[(begg+2)%4];
else return rezz+slova[(begg+3)%4];
}