Submission #485718

#TimeUsernameProblemLanguageResultExecution timeMemory
485718dongliu0426Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
using namespace std;

string guess_sequence(int N) {
	string s, c0, c1, c2;

	if (press("AB")) {
		if (press("A"))
			s = "a", c0 = "b", c1 = "x", c2 = "y";
		else
			s = "b", c0 = "a", c1 = "x", c2 = "y";
	} else {
		if (press("X"))
			s = "x", c0 = "a", c1 = "b", c2 = "y";
		else
			s = "y", c0 = "a", c1 = "b", c2 = "x";
	}
	for (int i = 1; i + 1 < N; i++) {
		int k = press(s + c0 + s + c1 + c0 + s + c1 + c1 + s + c1 + c2) - (int) s.size();

		if (k == 0)
			s += c2;
		else if (k == 1)
			s += c0;
		else
			s += c1;
	}
	if (N > 1) {
		if (press(s + c0) == N)
			s += c0;
		else if (press(s + c1) == N)
			s += c1;
		else
			s += c2;
	}
	return s;
}

Compilation message (stderr)

combo.cpp:3:1: error: 'string' does not name a type
    3 | string guess_sequence(int N) {
      | ^~~~~~