Submission #718877

#TimeUsernameProblemLanguageResultExecution timeMemory
718877nguyentunglamCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include "combo.h"
string guess_sequence(int n) {
    char head;
    if (press("AB")) {
        if (press("A")) head = 'A';
        else head = 'B';
    }
    else {
        if (press("X")) head = 'X';
        else head = 'Y';
    }

    string pref; pref.push_back(head);
    vector<char> C;
    if (head != 'A') C.push_back('A');
    if (head != 'B') C.push_back('B');
    if (head != 'X') C.push_back('X');
    if (head != 'Y') C.push_back('Y');
    for(int i = 2; i < n; i++) {
        int tmp = press(pref + C[0] + pref + C[1] + C[0] + pref + C[1] + C[1] + pref + C[1] + C[2]);
        if (tmp == i - 1) pref += C[2];
        else if (tmp == i) pref += C[0];
        else pref += C[1];
    }

    if (press(pref + C[0]) == n) pref.push_back(C[0]);
    else if (press(pref + C[1]) == n) pref.push_back(C[1]);
    else pref.push_back(C[2]);

    return pref;
}

Compilation message (stderr)

combo.cpp:2:1: error: 'string' does not name a type; did you mean 'stdin'?
    2 | string guess_sequence(int n) {
      | ^~~~~~
      | stdin