제출 #912228

#제출 시각아이디문제언어결과실행 시간메모리
912228tanprodium콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "combo.h"

string guess_sequence(int N) {
    string c = "ABXY";
    if (press("AB") >= 1) {
        if (press("A") == 1) {
        } else {
            swap(c[0], c[1]);
        }
    } else {
        if (press("X") == 1) {
            swap(c[0], c[2]);
        } else {
            swap(c[0], c[3]);
        }
    }
    string S = "";
    S += c[0];
    for (int i = 2; i < N; i++) {
        string str = S + c[1] + c[1] + S + c[1] + c[2] + S + c[1] + c[3] + S + c[2];
        int sz = (int)S.size();
        int taken = press(str);
        //cerr << str << ' ' << taken << '\n';
        if (taken - sz == 2)
            S += c[1];
        else if (taken - sz == 1)
            S += c[2];
        else S += c[3];
    }
    bool ok = false;
    for (int i = 1; i <= 2; i++) {
        string str = S + c[i];
        if (press(str) == N) {
            S += c[i];
            ok = true;
            break;
        }
    }
    if (!ok) S += c[3];
    return (S);
}

컴파일 시 표준 에러 (stderr) 메시지

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