Submission #362150

#TimeUsernameProblemLanguageResultExecution timeMemory
362150penguinhackerCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array string guess_sequence(int n) { string ans; if (press("AB") > 0) { if (press("A")) ans = "A"; else ans = "B"; } else { if (press("X")) ans = "X"; else ans = "Y"; } assert((int)ans.size() == 1); vector<char> v; if (ans != "A") v.push_back('A'); if (ans != "B") v.push_back('B'); if (ans != "X") v.push_back('X'); if (ans != "Y") v.push_back('Y'); assert(v.size() == 3); for (int i = 1; i < n - 1; ++i) { string s = ans + v[0] + v[0] + ans + v[0] + v[1] + ans + v[0] + v[2] + ans + v[1]; assert((int)s.size() <= 4 * n); int x = press(s); if (x == i) ans += v[2]; else if (x == i + 1) ans += v[1]; else if (x == i + 2) ans += v[0]; else assert(0); } assert((int)ans.size() == n - 1); if (press(ans + v[0]) == n) ans += v[0]; else if (press(ans + v[1]) == n) ans += v[1]; else ans += v[2]; assert((int)ans.size() == n); return ans; } /*int main() { ios::sync_with_stdio(0); cin.tie(0); return 0; } */

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:6: error: 'press' was not declared in this scope
    9 |  if (press("AB") > 0) {
      |      ^~~~~
combo.cpp:27:11: error: 'press' was not declared in this scope
   27 |   int x = press(s);
      |           ^~~~~
combo.cpp:34:6: error: 'press' was not declared in this scope
   34 |  if (press(ans + v[0]) == n) ans += v[0];
      |      ^~~~~