제출 #1352849

#제출 시각아이디문제언어결과실행 시간메모리
1352849adam17Flight to the Ford (BOI22_communication)C++20
컴파일 에러
0 ms0 KiB
void encode(int N, int X) {
    send((X == 3) ? 1 : 0);
    send((X == 2) ? 1 : 0);
    send((X == 2) ? 1 : 0);
    send((X == 3) ? 1 : 0);
}

std::pair<int,int> decode(int N) {
    int a = receive(), b = receive(), c = receive(), d = receive();
    if ((a + b + c + d == 0) || (a > b) || (c < d)) {
        return std::pair<int,int>{1, 3};
    }
    if ((a < b) || (c > d)) {
        return std::pair<int,int>{1, 2};
    }
    return std::pair<int,int>{2, 3};
}

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

communication.cpp: In function 'void encode(int, int)':
communication.cpp:2:5: error: 'send' was not declared in this scope
    2 |     send((X == 3) ? 1 : 0);
      |     ^~~~
communication.cpp: At global scope:
communication.cpp:8:6: error: 'pair' in namespace 'std' does not name a template type
    8 | std::pair<int,int> decode(int N) {
      |      ^~~~
communication.cpp:1:1: note: 'std::pair' is defined in header '<utility>'; did you forget to '#include <utility>'?
  +++ |+#include <utility>
    1 | void encode(int N, int X) {