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;
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};
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |