Submission #254938

#TimeUsernameProblemLanguageResultExecution timeMemory
254938jainbot27콤보 (IOI18_combo)C++17
0 / 100
1 ms200 KiB
#include <bits/stdc++.h>
#include <combo.h>
using namespace std;
#define nl endl
// int press(string x){
// 	cout << x << endl;
// 	int n;
// 	cin >> n;
// 	return n;
// }
string t[] = {"A", "B", "X", "Y"};
string guess_sequence(int n){
	string ret;
	string f="";
	if(press("AB")){
		if(press("A")) f += "A";
		else f+= "B";
	}
	else{
		if(press("X")) f += "X";
		else f+="Y";
	}
	vector<string> want;
	for(int i = 0; i < 4; i++){
		if(t[i] != f){
			want.push_back(t[i]);
		}
	}
	ret = f;
	for(int i = 2; i < n; i++){
		string query = "";
		query += ret + want[0] + ret + want[1] + want[0] + ret + want[1] + want[2] + ret + want[1] + want[1] + ret + want[2];
		int res = press(query);
		if(res == (int)ret.size()) ret += want[2];
		else if(res == (int)ret.size() + 1) ret += want[0];
		else ret += want[1];	
	}
	if(press(ret + want[0])==n) ret += want[0];
	else if(press(ret + want[1]) == n) ret += want[1];
	else ret += want[2];
	return ret;
}
// int main(){
// 	guess_sequence(69);
//
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...