Submission #401527

#TimeUsernameProblemLanguageResultExecution timeMemory
401527_DaNeK_콤보 (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(string p)
{
    cout << p << "\n";
    int a;
    cin >> a;
    return a;
}

string guess_sequence(int N)
{
    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)

/usr/bin/ld: /tmp/ccB87F8S.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/ccspOnyU.o:combo.cpp:(.text+0xc0): first defined here
collect2: error: ld returned 1 exit status