Submission #348350

#TimeUsernameProblemLanguageResultExecution timeMemory
348350NachoLibreCombo (IOI18_combo)C++14
5 / 100
2 ms200 KiB
#include <bits/stdc++.h>
using namespace std;

#ifdef wambule
int press(string) {
	return 0;
}
#else
#include "combo.h"
#endif

string s = "";

int ask(vector<string> v) {
	assert(v.size() < 5);
	string c = "";
	for(string t : v) {
		c += s + t;
	}
	return press(c) - s.size();
}

string guess_sequence(int n) {
	s = "";
	string c[] = {"X", "Y", "A", "B"};
	if(!ask({c[0], c[1]})) {
		swap(c[0], c[2]);
		swap(c[1], c[3]);
	}
	if(!ask({c[0]})) swap(c[0], c[1]);
	s = c[0];
	swap(c[0], c[3]);
	for(int i = 2; i < n; ++i) {
		int x = ask({c[0] + c[0], c[0] + c[1], c[0] + c[2], c[1]});
		if(x == 2) {
			s += c[0];
		} else if(x == 1) {
			s += c[1];
		} else {
			s += c[2];
		}
	}
	if(ask({c[0]})) s += c[0];
	else if(ask({c[1]})) s += c[1];
	else s += c[2];
	return s;
}

#ifdef wambule
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	return 0;
}
#endif
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...