Submission #1283404

#TimeUsernameProblemLanguageResultExecution timeMemory
1283404muhammad-mutahirCombo (IOI18_combo)C++20
0 / 100
1 ms332 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 = "";
	k = press("A");

	if(k){
		cr+="A";
	}
	else{
		k = press("B");
		if(k){
			cr+="B";
		}else{
			k = press("X");
			if(k){
				cr+="X";
			}
			else{
				cr+="Y";
			}
		}
	}

	string f = cr;
	vector<string>pos = {"A","B","X","Y"};
	vector<string>rem;
	for(auto i:pos){
		if(i != cr)rem.push_back(i);
	}
	
	// cr+s+f + cr+t+s+f + cr+t+t+f + cr+t+fo 
	int cl = 1;
	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){
			cr+=rem[2];
		}
		else if(k == cl+1){
			cr+=rem[0];
		}
		else{
			cr+=rem[1];
		}
		cl++;

	}
	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];
		}
	}
	// cout<<"ans"<<' '<<cr<<endl;
	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...