Submission #401879

#TimeUsernameProblemLanguageResultExecution timeMemory
401879hibye1217Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
std::string guess_sequence(int N) {
	std::string ans = "";
	int res = press("AB");
	if (res >= 1){
		res = press("A");
		if (res == 1){ ans += "A"; }
		else{ ans += "B"; }
	}
	else{
		res = press("X");
		if (res == 1){ ans += "X"; }
		else{ ans += "Y"; }
	}
	if (N == 1){ return ans; }
	char c1, c2, c3;
	if (ans[0] == 'A'){ c1 = 'B'; c2 = 'X'; c3 = 'Y'; }
	if (ans[0] == 'B'){ c1 = 'A'; c2 = 'X'; c3 = 'Y'; }
	if (ans[0] == 'X'){ c1 = 'A'; c2 = 'B'; c3 = 'Y'; }
	if (ans[0] == 'Y'){ c1 = 'A'; c2 = 'B'; c3 = 'X'; }
	for (int i = 2; i < N; i++){
		res = press(ans+c1+c1 + ans+c1+c2 + ans+c1+c3 + ans+c2);
		if (res > i){ ans += c1; }
		if (res == i){ ans += c2; }
		if (res < i){ ans += c3; }
	}
	res = press(ans+c1);
	if (res == N){ return ans+c1; }
	res = press(ans+c2);
	if (res == N){ return ans+c2; }
	else{ return ans+c3; }
}

Compilation message (stderr)

combo.cpp:1:6: error: 'string' in namespace 'std' does not name a type
    1 | std::string guess_sequence(int N) {
      |      ^~~~~~
combo.cpp:1:1: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
  +++ |+#include <string>
    1 | std::string guess_sequence(int N) {