Submission #630383

#TimeUsernameProblemLanguageResultExecution timeMemory
630383abekerCombo (IOI18_combo)C++17
100 / 100
38 ms744 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

string guess_sequence(int N) {
	string all = "ABXY";
	int pos = press("AB") ? press("B") : press("Y") + 2;
	string curr(1, all[pos]);
	
	if (N == 1)
		return curr;
		
	string rest = "";
	for (int i = 0; i < 4; i++)
		if (i != pos)
			rest += all[i];
			
	for (int i = 1; i < N - 1; i++) {
		string q = curr + rest[1];
		for (int j = 0; j < 3; j++)
			q += curr + rest[0] + rest[j];
		curr += rest[i - press(q) + 2];
	}
	
	int lst = 2;
	for (int i = 0; i < 2; i++)
		if (press(curr + rest[i]) == N) {
			lst = i;
			break;
		}
	
	return curr + rest[lst];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...