| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 750146 | tlnk07 | 콤보 (IOI18_combo) | C++17 | 0 ms | 0 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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];
			}
		}
	}
}
