#include "communication.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void anna(int X){
if(X==0){
int tmp = send(0);
if(!tmp){
tmp = send(0);
if(!tmp) send(0);
else send(1);
}
else send(0), send(0);
}
else if(X==1){
int tmp = send(0);
if(!tmp) send(0), send(0);
else send(1), send(1);
}
else{
int tmp = send(1);
if(tmp){
tmp = send(1);
if(tmp) send(1);
else send(0);
}
else send(1), send(0);
}
}
int decode(int A, int B, int C){
return vector<int> {0, 0, 1, 2, 2, 0, 1, 1} [A*4+B*2+C];
}
void encode(int N, int X){
X--;
anna(X);
}
pair<int, int> decode(int N){
int A = receive(), B = receive(), C = receive();
int tmp = decode(A, B, C);
return make_pair(tmp+1, (tmp+1)%3+1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
1740 KB |
Output is correct |
2 |
Correct |
7 ms |
1684 KB |
Output is correct |
3 |
Correct |
12 ms |
1728 KB |
Output is correct |
4 |
Correct |
9 ms |
1844 KB |
Output is correct |
5 |
Correct |
10 ms |
1800 KB |
Output is correct |
6 |
Correct |
21 ms |
1728 KB |
Output is correct |
7 |
Correct |
34 ms |
1688 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
20 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |