Submission #1283418

#TimeUsernameProblemLanguageResultExecution timeMemory
1283418muhammad-mutahirCombo (IOI18_combo)C++20
100 / 100
8 ms480 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;


// ABXYY
// int press(string k){
	// cout<<k<<endl;
	// int t;
	// cin>>t;
	// return t;
// }

string guess_sequence(int N) {
	int n , m , k , q;
	string cr = "";
// 	2
	k = press("AB");
	if(k){
		// cr+="A";
		k = press("A");
		if(k){
			cr+='A';
		}
		else{
			cr+='B';
		}
	}
	else{
		k = press("Y");
		if(k){
			cr+="Y";
		}
		else{
			cr+="X";
		}
	}

	string f = cr;
	vector<string>pos = {"A","B","X","Y"};
	vector<string>rem;
	for(auto i:pos){
		if(i != cr)rem.push_back(i);
	}
	int cl = 1;

	// (N-2)
	for(int i = 1;i<N-1;i++){
		int k = press(cr+rem[0] + cr+rem[1]+rem[0] + cr+rem[1]+rem[1] + cr+rem[1]+rem[2]);
		if(k == cl+1){
			cr+=rem[0];
		}
		else if(k == cl+2){
			cr+=rem[1];
		}
		else{
			cr+=rem[2];
		}
		cl++;

	}
// 	2
	if(N>=2){
	k = press(cr+rem[0]);
	if(k == N){
		cr+=rem[0];
	}
	else{
		k = press(cr+rem[1]);
		if(k == N){
			cr+=rem[1];
		}
		else{
			cr+=rem[2];
		}
	}
	}

	return cr;

}
// 
// signed main(){
    // ios::sync_with_stdio(0);//DO NOT USE IN INTERACTIVE
    // cin.tie(0), cout.tie(0);
    // cout << fixed<<setprecision(9);
    // string s = guess_sequence(5);
    // cout<<"ans :"<<s<<endl;
// }
// 
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...