Submission #1099081

# Submission time Handle Problem Language Result Execution time Memory
1099081 2024-10-10T13:29:13 Z LIA Stranded Far From Home (BOI22_island) C++17
Compilation error
0 ms 0 KB
//#include "communication.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pll;
typedef vector <ll> vll;
typedef vector <pll> vpll;
typedef vector<vector<pll>> vvpll;
typedef vector <vector<ll>> vvll;
typedef vector<bool> vb;
typedef vector <vector<bool>> vvb;
const ll inf = 1e9 + 7;


using namespace std;
typedef long long ll;

void encode(int N, int X) {
    if (N == 3) {
        if (X == 1) {
            send(0);
            send(0);
        } else if (X == 2) {
            send(0);
            send(1);
        } else if (X == 3) {
            send(1);
            send(1);
        }
    }
}

pair<int, int> decode(int N) {
    vector<int> signals;
    for (int i = 0; i < 2; ++i) {
        signals.push_back(receive());
    }

    if (signals[0] == 0 && signals[1] == 0) {
        return {1, 2};
    } else if (signals[0] == 0 && signals[1] == 1) {
        return {2, 3};
    } else if (signals[0] == 1 && signals[1] == 0) {
        return {1, 3};
    } else {
        return {3, 2};
    }
}

Compilation message

island.cpp: In function 'void encode(int, int)':
island.cpp:21:13: error: 'send' was not declared in this scope
   21 |             send(0);
      |             ^~~~
island.cpp:24:13: error: 'send' was not declared in this scope
   24 |             send(0);
      |             ^~~~
island.cpp:27:13: error: 'send' was not declared in this scope
   27 |             send(1);
      |             ^~~~
island.cpp: In function 'std::pair<int, int> decode(int)':
island.cpp:36:27: error: 'receive' was not declared in this scope
   36 |         signals.push_back(receive());
      |                           ^~~~~~~