#include "bits/stdc++.h"
#include "communication.h"
using namespace std;
void encode(int N, int X) {
vector<int> a(2);
a[0] = X % 2;
a[1] = (X / 2) % 2;
for (int i = 0; i < 125; i++) {
send(a[0]);
send(a[1]);
}
}
std::pair<int, int> decode(int N) {
for (int i = 0; i < 124; i++) {
int now = receive();
now += receive() * 2;
if (now == 3) continue;
if (now == 0) return {1, 2};
if (now == 1) return {1, 3};
if (now == 2) return {2, 3};
}
return {3, 3};
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
64 ms |
1708 KB |
Output is correct |
2 |
Correct |
185 ms |
1652 KB |
Output is correct |
3 |
Incorrect |
234 ms |
200 KB |
Not correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
895 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |