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 <iostream>
void encode(int N, int X) {
--X;
if (N > 3) return;
int position = 0;
int depth = 0;
while (depth < 2) {
int intent = 0;
if (position != (X + 2) % 3) intent = 1;
if (send(intent) == 0) {
++position;
position %= 3;
}
else ++depth;
}
// std::cerr << "Finish on position " << position << '\n';
}
std::pair<int, int> decode(int N) {
int position = 0;
int depth = 0;
while (depth < 2) {
if (receive() == 0) {
++position;
position %= 3;
}
else ++depth;
}
// std::cerr << "Finish on position " << position << '\n';
return { position + 1, (position + 2) % 3 + 1 };
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |