Submission #827115

#TimeUsernameProblemLanguageResultExecution timeMemory
827115HamletPetrosyanCombo (IOI18_combo)C++17
30 / 100
33 ms440 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

#define len(a) ((int)(a).size())

string guess_sequence(int N) {
	string p = "";
	int x;
	x = press("AB");
	if(x == 2) p += "AB";
	else if(x){
		x = press("A");
		if(x) p += "A";
		else p += "B";
	}
	else{
		x = press("X");
		if(x) p += "X";
		else p += "Y";
	}
	char ch[4] = {'A', 'B', 'X', 'Y'};
	for(int i = len(p) + 1; i <= N; i++){
		for(int j = 0, z = 0; j < 4; j++){
			if(ch[j] == p[0]) continue;
			z++;
			if(z == 3) p += ch[j];
			else {
				x = press(p + ch[j]);
				if(x == i){
					p += ch[j];
					break;
				}
			}
		}
	}
	return p;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...