Submission #1016462

#TimeUsernameProblemLanguageResultExecution timeMemory
1016462vjudge1Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

string guess_sequence(int N) {
	string s = "";
	string chars;
	// find first button
	int f = press("AB");
	if(f==1){
		int ff = press("A");
		if(ff==1) {
			chars = "BXY";
			s = "A";
		}
		else{
			chars = "AXY";
			s = "B";
		}
	}
	else{
		int ff = press("X");
		if(ff==1){
			chars = "ABY";
			s = "X";
		}
		else{
			chars = "ABX";
			s = "Y";
		}
	}
	
	// find 2nd to 2nd last button
	for (int i=2; i<N; i++){
		string qry = s+chars[1] + s+chars[2]+chars[0] + s+chars[2]+chars[1] + s+chars[2]+chars[2];
		int coins = press(qry);
		if(coins==i-1) s += chars[0];
		else if(coins==i) s += chars[1];
		else s += chars[2];
	}
	
	// find last button
	int l = qry(s+chars[0]);
	if(l==N) s += chars[0];
	else{
		int ll = qry(s+chars[1]);
		if(ll==N) s += chars[1];
		else s += chars[2];
	}
	return s;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:43:10: error: 'qry' was not declared in this scope
   43 |  int l = qry(s+chars[0]);
      |          ^~~