Submission #76336

# Submission time Handle Problem Language Result Execution time Memory
76336 2018-09-12T18:42:34 Z darthsidious Combo (IOI18_combo) C++14
Compilation error
0 ms 0 KB
#include <iostream>
#include <string>
//A B X Y

using namespace std;

// int press(string p) {
// 	if(p == "X")
// 		return 1;
// 	else
// 		return 0;
// }

string guess_sequence(int N) {
	string chars = "ABXY";
	string c[3];
	int start_c;
	for(int i=0;i<4;i++) {
		string tmp(1, chars[i]);
		int r = press(tmp);	
		if(r == 1) {
			start_c = i;
			break;
		}
	}

	for(int i=0;i<3;i++) {
		if(start_c <= i)
			c[i] = string(1, chars[i+1]);
		else
			c[i] = string(1, chars[i]);
	}
	// cout << (string)c << endl;	

	string ans(1, start_c);
	int test_char = 0;
	for(int i=0;i<7996;i++) {
		string test = ans;
		int len = test.size();

		test = ans + c[test_char%3];
		test_char++;

		if(press(test) > len)
			ans = test;
		// while(true) { //construct test string
			// for(int j=0;j<3;j++) {
			// 	test += ans + c[j];
			// }
		// }

	}

	return ans;
}

// int main() {
// 	guess_sequence(1);
// }

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:11: error: 'press' was not declared in this scope
   20 |   int r = press(tmp);
      |           ^~~~~
combo.cpp:44:6: error: 'press' was not declared in this scope
   44 |   if(press(test) > len)
      |      ^~~~~