제출 #83537

#제출 시각아이디문제언어결과실행 시간메모리
83537laptop_recai콤보 (IOI18_combo)C++11
컴파일 에러
0 ms0 KiB
//Bismillahirrahmanirrahim
#include<bits/stdc++.h>
#define fori(A,B,C) for(int A=B; A<C; ++A)
#define ford(A,B,C) for(int A=B; A>=C; --A)
#define fi          first
#define se          second
#define pb          push_back
#define pbp(A,B)    pb({A,B})
#define pp(A,B)     push({A,B})
using namespace std;
typedef long long       ll;
typedef pair<int,int>   ii;
const int maxn = 1e6 +7, inf = 1e9 +7, mod = 1e9 +7;

string guess_sequence(int N) {
    int k;
    char first;
    string S,button,p;

    k = press("AB");
    if(k == 2)
        first = 'A';
    else if(k == 1) {
        if(press("A") == 1)
            first = 'A', button = "BXY";
        else
            first = 'B', button = "AXY";
    }
    else {
        if(press("X") == 1)
            first = 'X', button = "ABY";
        else
            first = 'Y', button = "ABX";
    }

    S = first;

    fori(i,1,N-1) {
        p = (S + button[0]) + (S + button[1] + button[0]) + (S + button[1] + button[1]) + (S + button[1] + button[2]);
        k = press(p);
        if(k == i)
            S += button[2];
        else if(k == i+1)
            S += button[0];
        else
            S += button[1];
    }

    k = press(S + button[0] + S + button[1]);

    if(press(S + button[0]) == N)
        S += button[0];
    else if (press(S + button[1]) == N)
        S += button[1];
    else
        S += button[2];

    return S;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:9: error: 'press' was not declared in this scope
   20 |     k = press("AB");
      |         ^~~~~