제출 #657238

#제출 시각아이디문제언어결과실행 시간메모리
657238deviceCombo (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int press(string p);
string guess_sequence(int n) {
    string s = "ABXY", str = S[(press("AB") ? 0 : 2) + (press("AX") ? 0 : 1)];
    char c[3];
    int ptr = 0;
    for (char C:s) {
        if (C != str[0]) {
            c[ptr] = C, ptr++;
        }
    }
    if (n == 1) return str;
    for (int i = 2; i < n; i++) {
        string cur = str + c[2] + c[0] + str + c[2] + c[1] + str + c[2] + c[2] + str + c[1];
        int val = press(cur);
        val -= i - 1;
        str += c[val];
    }
    if (press(str + c[0]) == n) str += c[0];
    else if (press(str + c[1]) == n) str += c[1];
    else str += c[2];
    return str;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:30: error: 'S' was not declared in this scope
    6 |     string s = "ABXY", str = S[(press("AB") ? 0 : 2) + (press("AX") ? 0 : 1)];
      |                              ^