Submission #1351618

#TimeUsernameProblemLanguageResultExecution timeMemory
1351618Omar_GCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef string ss;
template<class T> using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define Omar_G ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) x.begin(), x.end()
#define endl "\n"
random_device rd;
mt19937 mt(rd());
int rnd(int l, int r) {
    return uniform_int_distribution<int>(l, r)(mt);
}
#define Y(x) ss((x) ? "Yes" : "No")
const ll mod = 676767677, inf = 5e18, N = 2e5 + 5, M = 500+5;
ss guess_sequence(int n) {
    ss c = "ABXY", s = "";
    for (ll i = 0; i < 3; i++) {
        if (press(c[i])) {
            s = c[i];
            swap(c[i], c[3]);
            break;
        }
    }
    if (!s.size()) s = c[3];
    while (s.size() + 1 < n) {
        ss q = s + c[0] + c[0] + s + c[0] + c[1] + s + c[0] + c[2] + s + c[1];
        ll a = press(q);
        if (a == s.size() + 2) s += c[0];
        else if (a == s.size() + 1) s += c[1];
        else s += c[2];
    }
    for (ll i = 0; i < 2; i++) {
        if (press(s + c[i]) == n) {
            return s+c[i];
        }
    }
    return s + c[2];
}
// void solve() {
    
// }
// int main() {
//     Omar_G
//     // freopen("a.in", "r", stdin);
//     // freopen("a.out", "w", stdout);
//     ll t = 1;
//     //cin >> t;
//     for (ll i = 1; i <= t; i++) {
//         solve();
//     }
//     return 0;
// }

Compilation message (stderr)

combo.cpp: In function 'ss guess_sequence(int)':
combo.cpp:23:13: error: 'press' was not declared in this scope
   23 |         if (press(c[i])) {
      |             ^~~~~
combo.cpp:32:16: error: 'press' was not declared in this scope
   32 |         ll a = press(q);
      |                ^~~~~
combo.cpp:38:13: error: 'press' was not declared in this scope
   38 |         if (press(s + c[i]) == n) {
      |             ^~~~~