Submission #89368

#TimeUsernameProblemLanguageResultExecution timeMemory
89368jhnah917Combo (IOI18_combo)C++14
5 / 100
2 ms200 KiB
#include "combo.h"
#include <vector>
using namespace std;
 
string guess_sequence(int N) {
	string arr = "";
	string key = "ABXY";
	char c;
	//i = 1
	if(press("AB") > 0){
		if(press("A") > 0) c = 'A';
		else c = 'B';
	}else if(press("X") > 0){
		c = 'X';
	}else c = 'Y';
	
	for(auto i : key) if(i!=c) arr += i;
	string s = ""; s += c;
	//2~N-1
	for(int i=2; i<=N-1; i++){
		string q = "";
		q += s; q += arr[0]; q += arr[0];
		q += s; q += arr[0]; q += arr[1];
		q += s; q += arr[0]; q += arr[2];
		q += s; q += arr[1]; q += s;
		int val = press(q);
		if(val == i-1) s += arr[2];
		if(val == i) s += arr[1];
		if(val == i+1) s += arr[0];
	}
	
	//N
	if(press(s + arr[0]) == N) s += arr[0];
	else if(press(s + arr[1]) == N) s += arr[1];
	else s += arr[2];
	return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...