Submission #1322319

#TimeUsernameProblemLanguageResultExecution timeMemory
1322319ceshCombo (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>
#include "combo.h"

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T>
using pq = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1e15;
ll MOD = 1e5 + 1;
ll MAXn = 2e6;
ll lg = 22;
const ld ap = 1e-6;
const double pi = acos(-1);
using rc = complex<double>;

template<class T>
istream &operator>>(istream &in, vector<T> &x) {
    for (auto &i : x) {
        in >> i;
    }
    return in;
}

template<class T>
ostream &operator<<(ostream &out, vector<T> &x) {
    for (auto &i : x) {
        out << i << ' ';
    }
    return out;
}

string guess_sequence(ll n) {
    vector<vector<ll>> is(n, vector<ll>(4));
    string f = "AX";
    ll c = press(f);
    string ans;
    vector<char> g;
    if (c >= 1) {
        f = "A";
        c = press(f);
        if (c >= 1) {
            for (ll i = 1; i < n; i++) is[i][0] = 1;
            ans.push_back('A');
            g.push_back('X');
            g.push_back('B');
            g.push_back('Y');
        } else {
            for (ll i = 1; i < n; i++) is[i][1] = 1;
            ans.push_back('X');
            g.push_back('A');
            g.push_back('B');
            g.push_back('Y');
        }
    } else {
        f = "B";
        c = press(f);
        if (c >= 1) {
            for (ll i = 1; i < n; i++) is[i][0] = 1;
            ans.push_back('B');
            g.push_back('A');
            g.push_back('X');
            g.push_back('Y');
        } else {
            for (ll i = 1; i < n; i++) is[i][1] = 1;
            ans.push_back('Y');
            g.push_back('A');
            g.push_back('X');
            g.push_back('B');
        }
    }
    for (ll i = 1; i < n - 1; i++) {
        string f = ans + g[0] + ans + g[1] + g[0] + ans + g[1] + g[1] + ans + g[1] + g[2];
        c = press(f);
        if (c >= ans.size() + 2) ans.push_back(g[1]);
        else if (c >= ans.size() + 1) ans.push_back(g[0]);
        else ans.push_back(g[2]);
    }
    c = press(ans + g[0]);
    if (c >= ans.size() + 1) ans.push_back(g[0]);
    else {
        c = press(ans + g[1]);
        if (c >= ans.size() + 1) ans.push_back(g[1]);
        else ans.push_back(g[2]);
    }
    return ans;
}

void viperr() {
    ll n;
    cin >> n;
    cout << guess_sequence(n);
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t11 = 1;
////    cin >> t11;
//    while (t11--) {
//        viperr();
//        cout << '\n';
//    }
    return 0;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccZlzzIj.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc8aAHTc.o:combo.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccZlzzIj.o: in function `main':
grader.cpp:(.text.startup+0x4b): undefined reference to `guess_sequence[abi:cxx11](int)'
collect2: error: ld returned 1 exit status