#include"communication.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int n, int x){
vector<int>arr;
for(int j = 1;j >= 0;j--){
if(x & (1<<j)){
arr.push_back(1);
}
else{
arr.push_back(0);
}
}
send(arr[0]);
send(arr[1]);
send(arr[1]);
send(arr[0]);
}
pair<int, int> decode(int n){
int a = 0,b = 0;
vector<int>ex;
for(int i = 0;i < 4;i++){
ex.push_back(receive());
}
if(ex[1] == ex[2]){
a = b = ex[1];
b += 2;
}
else if(ex[0] == ex[3]){
a = b = 2 * ex[0];
b++;
}
else{
a = ex[0] * 2 + ex[2];
b = ex[3] * 2 + ex[1];
}
a = max(1,a);
b = max(1,b);
b = min(n,b);
a = min(n,a);
return {a,b};
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
1656 KB |
Output is correct |
2 |
Correct |
10 ms |
1800 KB |
Output is correct |
3 |
Correct |
9 ms |
1600 KB |
Output is correct |
4 |
Correct |
7 ms |
1680 KB |
Output is correct |
5 |
Correct |
9 ms |
1688 KB |
Output is correct |
6 |
Correct |
19 ms |
1804 KB |
Output is correct |
7 |
Correct |
43 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
200 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |