Submission #1113567

#TimeUsernameProblemLanguageResultExecution timeMemory
1113567ZflopCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
//#include "combo.h"
string letter = "ABXY";
std::string guess_sequence(int N) {
  string ans;
  string actual;
  for (int i = 0; i < 4;++i) {
	  string ask{};
	  ask += letter[i];
	if (press(ask)) {
		ans += letter[i];
		}
	else 
		actual += letter[i]; 
	}
	while((int)ans.size() < N - 1) {
		string g = ans + actual[0] + actual[0] + ans + actual[0] + actual[1] + ans + actual[0] + actual[2] + ans + actual[1];
		int ret = press(g);
		if (ret == (int)ans.size())
			ans += actual[2];
		else if (ret == (int)ans.size() + 1)
			ans += actual[1];
		else 
			ans += actual[0];
		}
	string g = ans + actual[0];
	if (press(g) == N) return g;
	g = ans + actual[1];
	if (press(g) == N) return g;
  return ans + actual[2];
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:15:6: error: 'press' was not declared in this scope
   15 |  if (press(ask)) {
      |      ^~~~~
combo.cpp:23:13: error: 'press' was not declared in this scope
   23 |   int ret = press(g);
      |             ^~~~~
combo.cpp:32:6: error: 'press' was not declared in this scope
   32 |  if (press(g) == N) return g;
      |      ^~~~~
combo.cpp:34:6: error: 'press' was not declared in this scope
   34 |  if (press(g) == N) return g;
      |      ^~~~~