Submission #1352852

#TimeUsernameProblemLanguageResultExecution timeMemory
1352852adam17Flight to the Ford (BOI22_communication)C++20
Compilation error
0 ms0 KiB
#include <utility>
int send(int s);
std::pair<int,int> receive();

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};
}

Compilation message (stderr)

communication.cpp: In function 'std::pair<int, int> decode(int)':
communication.cpp:13:20: error: cannot convert 'std::pair<int, int>' to 'int' in initialization
   13 |     int a = receive(), b = receive(), c = receive(), d = receive();
      |             ~~~~~~~^~
      |                    |
      |                    std::pair<int, int>
communication.cpp:13:35: error: cannot convert 'std::pair<int, int>' to 'int' in initialization
   13 |     int a = receive(), b = receive(), c = receive(), d = receive();
      |                            ~~~~~~~^~
      |                                   |
      |                                   std::pair<int, int>
communication.cpp:13:50: error: cannot convert 'std::pair<int, int>' to 'int' in initialization
   13 |     int a = receive(), b = receive(), c = receive(), d = receive();
      |                                           ~~~~~~~^~
      |                                                  |
      |                                                  std::pair<int, int>
communication.cpp:13:65: error: cannot convert 'std::pair<int, int>' to 'int' in initialization
   13 |     int a = receive(), b = receive(), c = receive(), d = receive();
      |                                                          ~~~~~~~^~
      |                                                                 |
      |                                                                 std::pair<int, int>