Submission #401529

#TimeUsernameProblemLanguageResultExecution timeMemory
401529_DaNeK_Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

char m[4] = {'A', 'B', 'Y', 'X'};

int press()
{
    cout << p << "\n";
    int a;
    cin >> a;
    return a;
}

string guess_sequence()
{
    string res = "";
    int cur = 0, i = 0, first = 0;
    while (i < 3 && press(res + m[i]) != cur + 1)
        ++i;
    res += m[i];
    first = i;
    cur = 1;
    while (res.size() < (unsigned int ) N)
    {
        int ind = 0, cnt = 0;
        bool f = true;
        while (cnt < 2 && f)
        {
            if (ind == first) continue ;
            if (press(res + m[ind]) == cur + 1)
                f = false;
            if (f)
            {
                ++cnt;
                ++ind;
            }
        }
        if (ind == first)
            ++ind;
        ++cur;
        res += m[ind];
    }
    return res;

}

Compilation message (stderr)

combo.cpp: In function 'int press()':
combo.cpp:9:13: error: 'p' was not declared in this scope
    9 |     cout << p << "\n";
      |             ^
combo.cpp: In function 'std::string guess_sequence()':
combo.cpp:19:37: error: too many arguments to function 'int press()'
   19 |     while (i < 3 && press(res + m[i]) != cur + 1)
      |                                     ^
combo.cpp:7:5: note: declared here
    7 | int press()
      |     ^~~~~
combo.cpp:24:41: error: 'N' was not declared in this scope
   24 |     while (res.size() < (unsigned int ) N)
      |                                         ^
combo.cpp:31:35: error: too many arguments to function 'int press()'
   31 |             if (press(res + m[ind]) == cur + 1)
      |                                   ^
combo.cpp:7:5: note: declared here
    7 | int press()
      |     ^~~~~