Submission #225912

#TimeUsernameProblemLanguageResultExecution timeMemory
225912frodakcinCombo (IOI18_combo)C++11
5 / 100
1 ms200 KiB
#include "combo.h"

#include <algorithm>

using string = std::string;
string guess_sequence(int N) {
  string p = "";
  string S = "";
	char c[5] = "ABXY";
	if(press("XY"))
		std::swap(c[0], c[2]), std::swap(c[1], c[3]);
	p += c[1];
	if(press(p))
		std::swap(c[0], c[1]);
	S += c[0];
	for(int i = 1;i < N-1;++i)
	{
		p = "";
		p += S + c[1];
		p += S + c[2] + c[1];
		p += S + c[2] + c[2];
		p += S + c[2] + c[3];
		int v = press(p);
		if(v == i+1)
			S += c[1];
		else if(v == i+2)
			S += c[2];
		else
			S += c[3];
	}
	if(press(S + c[1]) == N)
		S += c[1];
	else if(press(S + c[2]) == N)
		S += c[2];
	else
		S += c[3];
  return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...