Submission #595116

#TimeUsernameProblemLanguageResultExecution timeMemory
595116thezomb1e콤보 (IOI18_combo)C++17
Compilation error
0 ms0 KiB
const string ABC = "ABXY";
string nABC;

string guess_sequence(int n) {
    string ans;
    int skip;
    {
        string cur;
        for (int i = 0; i < 4; i++) {
            cur += ABC[i];
        }
        if (press(cur.substr(0, 2))) {
            if (press(cur.substr(0, 1))) {
                skip = 0;
            } else {
                skip = 1;
            }
        } else {
            if (press(cur.substr(2, 1))) {
                skip = 2;
            } else {
                skip = 3;
            }
        }
        ans.pb(ABC[skip]);
    }
    for (int i = 0; i < 4; i++) {
        if (i == skip) continue;
        nABC.pb(ABC[i]);
    }
    for (int it = 2; it <= n; it++) {
        string cur;
        int sz = ans.size();
        for (int i = 0; i < 3; i++) {
            cur += ans;
            cur += nABC[i];
        }
        if (press(cur.substr(0, 2 * (sz + 1))) == it) {
            if (press(cur.substr(0, sz + 1)) == it) {
                ans.pb(nABC[0]);
            } else {
                ans.pb(nABC[1]);
            }
        } else {
            ans.pb(nABC[2]);
        }
    }
    return ans;
}

Compilation message (stderr)

combo.cpp:1:7: error: 'string' does not name a type
    1 | const string ABC = "ABXY";
      |       ^~~~~~
combo.cpp:2:1: error: 'string' does not name a type
    2 | string nABC;
      | ^~~~~~
combo.cpp:4:1: error: 'string' does not name a type
    4 | string guess_sequence(int n) {
      | ^~~~~~