Submission #139697

#TimeUsernameProblemLanguageResultExecution timeMemory
139697ekremCombo (IOI18_combo)C++11
5 / 100
3 ms1916 KiB


#include "combo.h"
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define MAXN 1000005
using namespace std;

typedef long long ll;
typedef pair < int , int > ii;

int n, m, ilk;
map < int , string > h, x;

string guess_sequence(int n) {
	h[1] = "A";
	h[2] = "B";
	h[3] = "X";
	h[4] = "Y";
	for(int i = 1; i <= 4; i++){
		if(press(h[i]) > 0){
			ilk = i;
			break;
		}
	}

	string s = "";
	// cout << s << endl;
	s += h[ilk];
	// cout << s << endl;
	for(int i = 1; i <= 4; i++){
		if(i == ilk)continue;
		x[++m] = h[i];
	}
	// cout << n << " " << ilk << " " << s << endl;
	for(int i = 2; i <= n - 1; i++){
		string sor = "";
		sor += s;sor += x[1];sor += x[1];
		sor += s;sor += x[1];sor += x[2];
		sor += s;sor += x[1];sor += x[3];
		sor += s;sor += x[2];
		// cout << n << " " << sor.size() << " " << sor << endl;
		int ans = press(sor);
		if(ans == i)
			s += x[2];
		else if(ans == i + 1)
			s += x[1];
		else
			s += x[3];
	}
	for(int i = 1; i <= 3; i++){
		if(press(s + x[i]) == n){
			s += x[i];
			break;
		}
	}
	return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...