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;
using ll = long long;
void encode(int N, int X) {
int x = X;
int f = (3 ^ x) & 2;
if (f == 0) {
if (send(0) == 0) {
if (send(0)) send((x & 1) ^ 1);
}
else {
send((x & 1) ^ 1);
}
}
else {
if (send(1) == 1) send(0);
else {
send(1), send(0);
}
}
}
pair<int, int> ex[4] = { {0,0}, {2, 3}, {1, 3}, {1, 2} };
pair<int, int> decode(int N) {
int val = 0;
if (receive()) {
val = 2 + receive();
return ex[val];
}
if (!receive()) return ex[1];
return ex[2 + receive()];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |