Submission #1217985

#TimeUsernameProblemLanguageResultExecution timeMemory
1217985islam_2010Combo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string s; vector<char> candidates = {'A', 'B', 'X', 'Y'}; string first_try = "AB"; if (press(first_try) == 1) { if (press("A") == 1) { s = "A"; candidates = {'B', 'X', 'Y'}; } else { s = "B"; candidates = {'A', 'X', 'Y'}; } } else { if (press("X") == 1) { s = "X"; candidates = {'A', 'B', 'Y'}; } else { s = "Y"; candidates = {'A', 'B', 'X'}; } } while (s.size() < n) { bool found = false; for (char c : candidates) { int res = press(s + c); if (res == s.size() + 1) { s += c; found = true; break; } } if (!found && s.size() == n - 1) { for (char c : candidates) { if (press(s + c) == n) { s += c; break; } } } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:9: error: 'press' was not declared in this scope
   10 |     if (press(first_try) == 1) {
      |         ^~~~~
combo.cpp:31:23: error: 'press' was not declared in this scope; did you mean 'res'?
   31 |             int res = press(s + c);
      |                       ^~~~~
      |                       res
combo.cpp:40:21: error: 'press' was not declared in this scope
   40 |                 if (press(s + c) == n) {
      |                     ^~~~~