Submission #1243007

#TimeUsernameProblemLanguageResultExecution timeMemory
1243007CirclingCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <iostream> #include <iomanip> #include <utility> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <algorithm> #include <cmath> #include <cstdint> using namespace std; /* int press(string p){ cout << p << endl; int k; cin >> k; return k; }*/ string guess_sequence(int n){ string ans, comb, c1, c2, c3; char first; if (press("AB") > 0) first = "BA"[press("A")]; else first = "XY"[press("Y")]; c1 = "AB"[first < 'B']; c2 = "BX"[first < 'X']; c3 = "XY"[first < 'Y']; ans += first; comb = c1 + c2 + c3; for (int i = 1; i < n - 1; i++) ans += comb[press(ans + c2 + ans + c3 + c1 + ans + c3 + c2 + ans + c3 + c3) - i]; if (press(ans + c1) == n) return ans + c1; else if (press(ans + c2) == n) return ans + c2; else return ans + c3; } /* int main(){ cout << guess_sequence(5) << endl; } */

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:9: error: 'press' was not declared in this scope
   26 |     if (press("AB") > 0) first = "BA"[press("A")];
      |         ^~~~~
combo.cpp:33:49: error: 'press' was not declared in this scope
   33 |     for (int i = 1; i < n - 1; i++) ans += comb[press(ans + c2 + ans + c3 + c1 + ans + c3 + c2 + ans + c3 + c3) - i];
      |                                                 ^~~~~
combo.cpp:34:9: error: 'press' was not declared in this scope
   34 |     if (press(ans + c1) == n) return ans + c1;
      |         ^~~~~
combo.cpp:37:1: warning: control reaches end of non-void function [-Wreturn-type]
   37 | }
      | ^