Submission #252563

#TimeUsernameProblemLanguageResultExecution timeMemory
252563ChrisTCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; string guess_sequence (int n) { string ret; char fi; if (press("XY")) { ret += (fi = press("X") ? 'X' : 'Y'); } else { ret += (fi = press("A") ? 'A' : 'B'); } char a = 'A' + (fi == 'A'); char b = fi <= 'B' ? 'X' : 'B'; char c = fi <= 'X' ? 'Y' : 'X'; for (int i = 2; i < n; i++) { int go = press(ret + a + ret + b + a + ret + b + b + ret + b + c); if (go == i+1) ret += b; else if (go == i) ret += a; else ret += c; } if (ret.length() < n) { int go = press(ret + a + ret + b); if (go == n) { ret += press(ret + a) == n ? a : b; } else { ret += c; } } return ret; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:5:6: error: 'press' was not declared in this scope
    5 |  if (press("XY")) {
      |      ^~~~~
combo.cpp:14:12: error: 'press' was not declared in this scope
   14 |   int go = press(ret + a + ret + b + a + ret + b + b + ret + b + c);
      |            ^~~~~
combo.cpp:19:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |  if (ret.length() < n) {
      |      ~~~~~~~~~~~~~^~~
combo.cpp:20:12: error: 'press' was not declared in this scope
   20 |   int go = press(ret + a + ret + b);
      |            ^~~~~