제출 #479487

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

string guess_sequence(int N){
    string ret = "";
    char exc, arr[4] = {'A', 'B', 'X', 'Y'};
    if (press("A") == 1){
        ret = "A"; exc = 'A';
    }
    else if (press("B") == 1){
        ret = "B"; exc = 'B';
    }
    else if (press("X") == 1){
        ret = "X"; exc = 'X';
    }
    else {
        ret = "Y"; exc = 'Y';
    }
    int cnt = 2;
    while ((int)ret.size() < N){
        for (int i = 0; i < 4; i++){
            if (arr[i] != exc){
                string temp = ret;
                temp += arr[i];
                if (press(temp) == cnt){
                    cnt++;
                    break;
                }
            }
        }
    }
    return ret;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:9: error: 'press' was not declared in this scope
    7 |     if (press("A") == 1){
      |         ^~~~~
combo.cpp:25:21: error: 'press' was not declared in this scope
   25 |                 if (press(temp) == cnt){
      |                     ^~~~~