Submission #909940

#TimeUsernameProblemLanguageResultExecution timeMemory
909940raphaelpCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N)
{
    string ans;
    int temp = press("AB");
    if (temp)
    {
        temp = press("A");
        if (temp)
            ans.push_back('A');
        else
            ans.push_back('B');
    }
    else
    {
        temp = press("X");
        if (temp)
            ans.push_back('X');
        else
            ans.push_back('Y');
    }
    if (N == 1)
        return ans;
    string left;
    if (ans != "A")
        left.push_back('A');
    if (ans != "B")
        left.push_back('B');
    if (ans != "X")
        left.push_back('X');
    if (ans != "Y")
        left.push_back('Y');
    for (int i = 1; i < N - 1; i++)
    {
        string p = ans;
        p += left[0];
        for (int j = 0; j < 3; j++)
        {
            p += ans;
            p += left[1];
            p += left[j];
        }
        temp = press(p);
        if (temp == i)
            ans.push_back(left[2]);
        if (temp == i + 1)
            ans.push_back(left[0]);
        if (temp == i + 2)
            ans.push_back(left[1]);
    }
    string p = ans + left[0];
    temp = press(p);
    if (temp == N)
        ans.push_back(left[0]);
    else
    {
        p = ans + left[1];
        temp = press(p);
        if (temp == N)
            ans.push_back(left[1]);
        else
            ans.push_back(left[2]);
    }
    return ans;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:16: error: 'press' was not declared in this scope
    6 |     int temp = press("AB");
      |                ^~~~~