Submission #1144147

#TimeUsernameProblemLanguageResultExecution timeMemory
1144147crispxxCombo (IOI18_combo)C++20
30 / 100
10 ms460 KiB
#include <bits/stdc++.h>
#include "combo.h"

// #include "grader.cpp"

using namespace std;

#define all(x) x.begin(), x.end()

string guess_sequence(int n) {
	int pf = 0;
	
	string p;
	
	vector<char> F {'A', 'B', 'X'};
	
	for(auto c : F) {
		if(press(p + c) == pf + 1) {
			pf++;
			p += c;
			F.erase(find(all(F), c));
			break;
		}
	}
	
	if(!pf) {
		p += 'Y';
		pf++;
	} else {
		F.push_back('Y');
	}
	
	vector<char> S {F[0], F[1]};
	
	for(int i = 1; i < n; i++) {
		int _pf = pf;
		
		for(auto c : S) {
			if(press(p + c) == pf + 1) {
				p += c;
				pf++;
				break;
			}
		}
		
		if(_pf == pf) {
			p += F[2];
			pf++;
		}
	}
	
	return p;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...