Submission #1272274

#TimeUsernameProblemLanguageResultExecution timeMemory
1272274jungle15콤보 (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define Jungle "ioi18p1"
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int M = 4;
const char LET[M] = { 'A', 'B', 'X', 'Y' };
string S;
int N;
int qcnt = 0;

int guess_one(const string &s)
{
    int len = press(s + LET[0] + s + LET[1]);
    int idx = 2 * (len < (int)s.length() + 1);
    len = press(s + LET[idx]);
    idx += (len < (int)s.length() + 1);
    return idx;
}

string guess_sequence(int N)
{
    int idx[M];
    REP(i, M)
        idx[i] = i;
    string s;
    {
        int id = guess_one(s);
        s += LET[id];
        swap(idx[id], idx[M - 1]);
    }
    REP(i, N - 2)
    {
        string z;
        REP(j, M - 1)
        {
            z += s;
            z.push_back(LET[idx[0]]);
            z.push_back(LET[idx[j]]);
        }
        z += s;
        z.push_back(LET[idx[1]]);
        int len = press(z);
        if (len == i + 3)
            s.push_back(LET[idx[0]]);
        else if (len == i + 2)
            s.push_back(LET[idx[1]]);
        else
            s.push_back(LET[idx[2]]);
    }
    if (N > 1)
    {
        int id = guess_one(s);
        s += LET[id];
    }
    return s;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    if (!(cin >> S))
        return 0;
    N = (int)S.size();
    string res = guess_sequence(N);
    cout << res << '\n';
    return 0;
}

Compilation message (stderr)

combo.cpp: In function 'int guess_one(const std::string&)':
combo.cpp:13:15: error: 'press' was not declared in this scope
   13 |     int len = press(s + LET[0] + s + LET[1]);
      |               ^~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:42:19: error: 'press' was not declared in this scope
   42 |         int len = press(z);
      |                   ^~~~~