Submission #1072426

#TimeUsernameProblemLanguageResultExecution timeMemory
1072426andrewpCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
//Dedicated to my love, ivaziva //#include "combo.h" #include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using ll = int64_t; #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define dbg(x) cerr << #x << ": " << x << '\n'; string guess_sequence(int n) { char f; if (press("AB")) { if (press("A")) f = 'A'; else f = 'B'; } else { if (press("Y") == 1) f = 'Y'; else f = 'X'; } string ans = ""; ans.push_back(f); int sz = 1; for (int i = 2; i < n; i++) { if (f == 'A') { int ret = press(ans + "Y" + ans + "XX" + ans + "XY" + ans + "XB"); if (ret == sz + 1) ans.push_back('Y'); else if (ret == sz + 2) ans.push_back('X'); else ans.push_back('B'); } else if (f == 'B') { int ret = press(ans + "Y" + ans + "XX" + ans + "XY" + ans + "XA"); if (ret == sz + 1) ans.push_back('Y'); else if (ret == sz + 2) ans.push_back('X'); else ans.push_back('A'); } else if (f == 'X') { int ret = press(ans + "Y" + ans + "AA" + ans + "AY" + ans + "AB"); if (ret == sz + 1) ans.push_back('Y'); else if (ret == sz + 2) ans.push_back('A'); else ans.push_back('B'); } else if (f == 'Y') { int ret = press(ans + "X" + ans + "AX" + ans + "AA" + ans + "AB"); if (ret == sz + 1) ans.push_back('X'); else if (ret == sz + 2) ans.push_back('A'); else ans.push_back('B'); } sz++; } if (sz == n) { return ans; } if (f == 'A') { if (press(ans + 'X') == n) ans.push_back('X'); else if (press(ans + 'Y') == n) ans.push_back('Y'); else ans.push_back('B'); } else if (f == 'B') { if (press(ans + 'X') == n) ans.push_back('X'); else if (press(ans + 'Y') == n) ans.push_back('Y'); else ans.push_back('A'); } else if (f == 'X') { if (press(ans + 'Y') == n) ans.push_back('Y'); else if (press(ans + 'B') == n) ans.push_back('B'); else ans.push_back('A'); } else if (f == 'Y') { if (press(ans + 'A') == n) ans.push_back('A'); else if (press(ans + 'X') == n) ans.push_back('X'); else ans.push_back('B'); } return ans; } /*int32_t main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cerr.tie(nullptr); return 0; }*/

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:15:9: error: 'press' was not declared in this scope
   15 |     if (press("AB")) {
      |         ^~~~~
combo.cpp:31:23: error: 'press' was not declared in this scope
   31 |             int ret = press(ans + "Y" + ans + "XX" + ans + "XY" + ans + "XB");
      |                       ^~~~~
combo.cpp:39:23: error: 'press' was not declared in this scope
   39 |             int ret = press(ans + "Y" + ans + "XX" + ans + "XY" + ans + "XA");
      |                       ^~~~~
combo.cpp:47:23: error: 'press' was not declared in this scope
   47 |             int ret = press(ans + "Y" + ans + "AA" + ans + "AY" + ans + "AB");
      |                       ^~~~~
combo.cpp:56:23: error: 'press' was not declared in this scope
   56 |             int ret = press(ans + "X" + ans + "AX" + ans + "AA" + ans + "AB");
      |                       ^~~~~
combo.cpp:70:13: error: 'press' was not declared in this scope
   70 |         if (press(ans + 'X') == n)
      |             ^~~~~
combo.cpp:77:13: error: 'press' was not declared in this scope
   77 |         if (press(ans + 'X') == n)
      |             ^~~~~
combo.cpp:84:13: error: 'press' was not declared in this scope
   84 |         if (press(ans + 'Y') == n)
      |             ^~~~~
combo.cpp:91:13: error: 'press' was not declared in this scope
   91 |         if (press(ans + 'A') == n)
      |             ^~~~~