| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 750146 | tlnk07 | Combo (IOI18_combo) | C++17 | 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<bits/stdc++.h>
using namespace std;
string guess_sequence(int N)
{
	string s;
	string c[10];
	int hm = press("AB");
	if(hm == 0)
	{
		if(press("C") == 0)
		{
			s += 'Y';
			c[1] = 'A';	c[2] = 'B';	c[3] = 'X';
		}
		else
		{
			s += 'X';
			c[1] = 'A';	c[2] = 'B';	c[3] = 'Y';
		}
	}
	else if(hm == 1)
	{
		if(press("A") == 0)
		{
			s += 'B';
			c[1] = 'A';	c[2] = 'Y';	c[3] = 'X';
		}
		else
		{
			s += 'A';
			c[1] = 'X';	c[2] = 'B';	c[3] = 'Y';
		}
	}
	else
	{
		s += "AB";
	}
	int sz = s.size();
	while(sz < N - 1)
	{
		string temp = s + c[1] + c[1] + s + c[1] + c[2] + s + c[2] + c[1];
		int inp = press(temp);
		if(inp == sz)
		{
			s += c[3];
		}
		else if(inp == sz + 1)
		{
			string temp1 = s + c[2] + c[2];
			int inp1 = press(temp1);
			if(inp1 == sz + 2)
			{
				s = temp1;
			}
			else if(inp1 == sz + 1)
			{
				s += c[2] + c[3];
			}
			else
			{
				s += c[1] + c[3];
			}
		}
		else
		{
			string temp1 = s + c[1] + c[1];
			int inp1 = press(temp1);
			if(inp1 == sz + 2)
			{
				s = temp1;
			}
			else if(inp1 == sz + 1)
			{
				s += c[1] + c[2];
			}
			else
			{
				s += c[2] + c[1];
			}
		}
		sz = s.size();
	}
	if(sz == N)
	{
		return s;
	}
	else
	{
		string temp = s + c[1];
		if(press(temp) == N)
		{
			return temp;
		}
		else
		{
			temp = s + c[2];
			if(press(temp) == N)
			{
				return temp;
			}
			else
			{
				return s + c[3];
			}
		}
	}
}
