제출 #497366

#제출 시각아이디문제언어결과실행 시간메모리
497366Ai7081콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

int press(string p)

string guess_sequence(int n) {
    int in, t;
    string out, s, c;
    in = press("AB");
    if (in) {
        in = press("A");
        in ? out="A" : out="B";
    }
    else {
        in = press("X");
        in ? out="X" : out="Y";
    }

    string tmp = "ABXY";
    for (int i=0; i<4; i++) if (tmp[i]!=out[i]) c+=tmp[i];

    for (t=1; t<n; t++) {
        s = out;
        s += c[0];
        for (int i=0; i<3; i++) {
            s += out;
            s += c[1];
            s += c[i];
        }
        in = press(s);
        if (in == t) out+=c[2];
        else if (in == t+1) out+=c[0];
        else if (in == t+2) out+=c[1];
    }
    return out;
}

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

combo.cpp:6:1: error: expected initializer before 'string'
    6 | string guess_sequence(int n) {
      | ^~~~~~