# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1099059 | LIA | Flight to the Ford (BOI22_communication) | C++17 | 10 ms | 332 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
void encode(int N, int X) {
vector<int> signals(3);
if (X == 1) {
signals[0] = 0;
signals[1] = 0;
signals[2] = 0;
} else if (X == 2) {
signals[0] = 0;
signals[1] = 1;
signals[2] = 0;
} else if (X == 3) {
signals[0] = 1;
signals[1] = 0;
signals[2] = 0;
}
for (int i = 0; i < signals.size(); ++i) {
send(signals[i]);
}
}
pair<int, int> decode(int N) {
vector<int> receivedSignals(3);
for (int i = 0; i < receivedSignals.size(); ++i) {
receivedSignals[i] = receive();
}
if (receivedSignals[0] == 0 && receivedSignals[1] == 0) {
return {1, 2};
} else if (receivedSignals[0] == 0 && receivedSignals[1] == 1) {
return {2, 3};
} else if (receivedSignals[0] == 1 && receivedSignals[1] == 0) {
return {3, 1};
} else {
return {1, 1};
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |