Submission #1286061

#TimeUsernameProblemLanguageResultExecution timeMemory
1286061harryleeeCombo (IOI18_combo)C++20
100 / 100
9 ms476 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 998244353
string guess_sequence(int n)
{
	string a = "A", b = "B", x = "X", y = "Y", k, e;
	ll f = press(a + b), i = 2;
	if(f){
		if(press(a)){
			e = a;
			a = y;
		}
		else{
			e = b;
			b = y;
		}
		k += e;
	}
	else{
		if(press(x)){
			e = x;
			x = y;
			k += e;
		}
		else{
			k += y;
		}
	}
	for (; i < n; i++){
		f  = press(k + a + k + b + a + k + b + b + k + b + x);
		if(f - i - 1){
			if(f - i){
				k += x;
			}
			else{
				k += a;
			}
		}
		else{
			k += b;
		}
	}
	if (n - 1){
		if(press(k + a) - i + 1){
			k += a;
		}
		else{
			if(press(k + b) - i + 1){
				k += b;
			}
			else{
				k += x;
			}
		}
	}
	return k;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...