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 <bits/stdc++.h>
#include "communication.h"
using namespace std;
int answer[3][4] = {{0, 0, 0, 0}, {0, 1, 1, 0}, {1, 1, 1, 1}};
void encode(int n, int x) {
for (int x: answer[x-1]) {
send(x);
}
}
int corruptible(int* a, int* b, int size) {
bool canCorrupt = true;
for (int i = 0; i < size; i++) {
if (a[i] != b[i]) {
if (!canCorrupt) return false;
canCorrupt = false;
} else {
canCorrupt = true;
}
}
return true;
}
pair<int, int> decode(int n) {
int res[4];
for (int& x: res) x = receive();
vector<int> poss;
for (int i = 0; i < 3; i++) {
if (corruptible(res, answer[i], 4)) {
poss.push_back(i+1);
}
}
poss.push_back(1);
return {poss[0], poss[1]};
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |