# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
203886 | V003 | 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)
{
char c[4]={'A', 'B', 'X', 'Y'};
string s="";
int x;
if(press("AB">=1)) x=press("A")!=1;
else x=2+press("X"<1);
s+=c[x];
if(n==1)
return s;
swap(c[x]. c[3]);
for(int i=1; i<n-1; i++)
{
x=press(s+c[0]+c[0]+s+c[0]+c[1]+s+c[0]+c[2]+s+c[1]);
if(x==i+1) s+=c[1];
if(x==i+2) s+=c[0];
if(x==i) s+=c[2];
}
if(press(s+c[0]+s+c[1])==n)
{
if(press(s+c[0]))
s+=c[0];
else
s+=c[1];
}
else
s+=c[2];
return s;
}