# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154039 | mohamedsobhi777 | 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"
using namespace std;
std::string guess_sequence(int N) {
string ret = "";
string chs = "ABXY";
if( pres("XY") )
{
if(pres("X"))ret = "X" , chs = "ABY";
else ret = "Y" , chs = "ABX";
}
else
{
if(pres("A"))ret = "A" , chs = "BXY";
else ret = "B" , chs ="AXY";
}
for(int i = 1;i<N;i++)
{
bool ok = 0;
for(int j = 0;j<2;j++)
{
string ask = ret;
ask+=chs[j];
if( press( ask ) ==i+1 )
{
ret+=chs[j];
ok = 1;
break;
}
}
if(ret.size()==i)
ret+=chs[2];
}
return ret;
}