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;
pair<int,int> decode(int n) {
mt19937 rng(n);
int x=rng();
if (x&1) {
for (int i=0; i<100; ++i) {
int f=receive(), s=receive();
if (f==s) {
if (f==0) return {1,2};
else return {2,3};
}
}
} else {
for (int i=0; i<100; ++i) {
int f=receive(), s=receive();
if (f==s) {
if (f==1) return {1,2};
else return {2,3};
}
}
}
x=rng();
if (x&1) return {1,3};
else return {2,3};
}
void encode(int n, int x) {
mt19937 rng(n);
int p=rng();
if (p&1) {
for (int i=0; i<100; ++i) {
if (x<=2) send(0);
else send(1);
if (x<=2) send(0);
else send(1);
}
} else {
for (int i=0; i<100; ++i) {
if (x>=2) send(0);
else send(1);
if (x>=2) send(0);
else send(1);
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |