Submission #348346

# Submission time Handle Problem Language Result Execution time Memory
348346 2021-01-14T17:34:34 Z NachoLibre Combo (IOI18_combo) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#ifdef wambule
int press(string) {
	return 0;
}
#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) {
	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]);
	swap(c[0], c[3]);
	for(int i = 1; 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

Compilation message

combo.cpp: In function 'int ask(std::vector<std::__cxx11::basic_string<char> >)':
combo.cpp:18:9: error: 'press' was not declared in this scope
   18 |  return press(c) - s.size();
      |         ^~~~~