Submission #874892

#TimeUsernameProblemLanguageResultExecution timeMemory
874892tuannmCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB

#include<bits/stdc++.h>
using namespace std;

string guess_sequence(int N){
    int x;
	string s;
	char c[4] = {'A', 'B', 'X', 'Y'};
	if(press("AB") >= 1){
        x = (press("A") != 1);
	}
	else
        x = 2 + (press("X") < 1);
	s += c[x];
	if(N == 1)
        return s;
	swap(c[x], c[3]);
	for(int i = 1; i < N - 1; ++i){
		x = press(s + c[0] + c[0] + s + c[0] + c[1] + s + c[0] + c[2] + s + c[1]);
		if(x == i + 2)
            s += c[0];
		else if(x == i + 1)
            s += c[1];
		else
            s += c[2];
	}
	if(press(s + c[0] + s + c[1]) == N){
		if(press(s + c[0]) == N)
            s += c[0];
		else
            s += c[1];
	}
    else s += c[2];
	return s;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:5: error: 'press' was not declared in this scope
    9 |  if(press("AB") >= 1){
      |     ^~~~~
combo.cpp:19:7: error: 'press' was not declared in this scope
   19 |   x = press(s + c[0] + c[0] + s + c[0] + c[1] + s + c[0] + c[2] + s + c[1]);
      |       ^~~~~
combo.cpp:27:5: error: 'press' was not declared in this scope
   27 |  if(press(s + c[0] + s + c[1]) == N){
      |     ^~~~~