Submission #1217638

#TimeUsernameProblemLanguageResultExecution timeMemory
1217638nickolasarapidisCombo (IOI18_combo)C++17
0 / 100
0 ms408 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;

string guess_sequence(int N){
	string S;
	char start;
	if(press("A") == 1) start = 'A';
	else{
		int q = press("BXBXAXY");
		if(q == 1) start = 'B';
		if(q == 2) start = 'X';
		if(q == 0) start = 'Y';
	}
	S += start;
	vector<char> c;
	if(start != 'A') c.push_back('A');
	if(start != 'B') c.push_back('B');
	if(start != 'X') c.push_back('X');
	if(start != 'Y') c.push_back('Y');
	for(int i = 1; i < N - 1; i++){
		int q = press(S + c[0] + S + c[1] + c[0] + S + c[1] + c[1] + S + c[1] + c[2]);
		if(q == i + 1) S += c[0];
		else if(q == i + 2) S += c[1];
		else S += c[2];
	}
	if(S.size() == N - 1){
		if(press(S + c[0]) == N) S += c[0];
		else if(press(S + c[1]) == N) S += c[1];
		else S += c[2];
	}
	return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...