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