#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()];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
2744 KB |
Output is correct |
2 |
Correct |
5 ms |
2752 KB |
Output is correct |
3 |
Correct |
7 ms |
2740 KB |
Output is correct |
4 |
Correct |
10 ms |
2744 KB |
Output is correct |
5 |
Correct |
10 ms |
2736 KB |
Output is correct |
6 |
Correct |
10 ms |
2824 KB |
Output is correct |
7 |
Correct |
20 ms |
2744 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
332 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |