Submission #536406

#TimeUsernameProblemLanguageResultExecution timeMemory
536406fuad27Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
char keys[] = {'A','B','X','Y'};
string B = "", X ="", Y ="";
vector<char> keys2;
char next_char(string s) {
	B = "", X ="", Y ="";
	B.push_back(keys2[0]);
	X.push_back(keys2[1]);
	Y.push_back(keys2[2]);
	string ask = s+B + s + X + B + s + X + X + s + X + Y;
	int val = press(ask) - s.size();
	if(val == 1)return B[0];
	else if(val == 2)return X[0];
	return Y[0];
}
string guess_sequence(int n) {
	string p = "";
	for(int i = 0;i<3;i++) {
		p.push_back(keys[i]);
		if(press(p) == 1) {
			break;
		}
		p.pop_back();
	}
	if(p.size() == 0) {
		p.push_back(keys[3]);
	}
	char start = p[0];
	for(int i = 0;i<4;i++) {
		if(keys[i] == start)continue;
		keys2.push_back(keys[i]);
	}
	for(int j = 1;j<n-1;j++) {
		char c = next_char(p);
		p.push_back(c);
	}
	for(int i = 0;i<2;i++) {
		p.push_back(keys2[i]);
		if(press(p) == nAB) {
			break;
		}
		p.pop_back();
	}
	if((int)p.size()!=n) {
		p.push_back(keys2[2]);
	}
	return p;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:41:18: error: 'nAB' was not declared in this scope
   41 |   if(press(p) == nAB) {
      |                  ^~~