Submission #874893

#TimeUsernameProblemLanguageResultExecution timeMemory
874893tuannmCombo (IOI18_combo)C++17
100 / 100
11 ms1912 KiB
#include "combo.h"
#include<bits/stdc++.h>
using namespace std;

string guess_sequence(int N){
    int x;
	string s;
	char c[4] = {'A', 'B', 'X', 'Y'};
	if(press("AB") >= 1){
        x = (press("A") != 1);
	}
	else
        x = 2 + (press("X") < 1);
	s += c[x];
	if(N == 1)
        return s;
	swap(c[x], c[3]);
	for(int i = 1; i < N - 1; ++i){
		x = press(s + c[0] + c[0] + s + c[0] + c[1] + s + c[0] + c[2] + s + c[1]);
		if(x == i + 2)
            s += c[0];
		else if(x == i + 1)
            s += c[1];
		else
            s += c[2];
	}
	if(press(s + c[0] + s + c[1]) == N){
		if(press(s + c[0]) == N)
            s += c[0];
		else
            s += c[1];
	}
    else s += c[2];
	return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...