Submission #139686

#TimeUsernameProblemLanguageResultExecution timeMemory
139686ekremCombo (IOI18_combo)C++11
5 / 100
2 ms1948 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;
char h[10], x[10];

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

	string s = "";
	s += h[ilk];
	for(int i = 1; i <= 4; i++){
		if(i == ilk)continue;
		x[++m] = h[i];
	}
	// cout << n << " " << ilk << endl;
	for(int i = 2; i <= n - 1; i++){
		string sor = "";
		sor += s + x[1] + x[1];
		sor += s + x[1] + x[2];
		sor += s + x[1] + x[3];
		sor += s + x[2];
		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;
		}
	}
	// cout << s << endl;
	return s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...