이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |