#include "communication.h"
using namespace std;
typedef pair<int, int> pi;
void encode(int n, int a) {
if (send(a == 1 ? 0 : 1) == 1 && send(a == 2 || a == 3 ? 0 : 1) == 0)
return;
send(a == 1 || a == 2 ? 0 : 1);
}
pi decode(int n) {
if (receive() == 1 && receive() == 0)
return {2, 3};
return receive() == 0 ? make_pair(1, 2) : make_pair(1, 3);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1696 KB |
Output is correct |
2 |
Correct |
9 ms |
1716 KB |
Output is correct |
3 |
Correct |
9 ms |
1664 KB |
Output is correct |
4 |
Correct |
8 ms |
1668 KB |
Output is correct |
5 |
Correct |
9 ms |
1668 KB |
Output is correct |
6 |
Correct |
18 ms |
1708 KB |
Output is correct |
7 |
Correct |
39 ms |
1640 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
14 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |