#include"communication.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int N, int X) {
int cnt=0;
X=X%3;
for (int i=1; i<=4; i++)
{
if ((cnt%3)==X) cnt+=send(1);
else cnt+=send(0);
}
}
std::pair<int, int> decode(int N) {
int cnt=0;
vector<int> sm(3);
for (int i=1; i<=4; i++)
{
cnt+=receive();
sm[cnt%3]++;
}
vector<pair<int, int>> v;
for (int i=0; i<3; i++) v.push_back({sm[i], (i==0)?3:i});
sort(v.begin(), v.end());
return {v[0].second, v[1].second};
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
2776 KB |
Output is correct |
2 |
Correct |
6 ms |
3172 KB |
Output is correct |
3 |
Correct |
6 ms |
2748 KB |
Output is correct |
4 |
Correct |
4 ms |
2916 KB |
Output is correct |
5 |
Correct |
7 ms |
2744 KB |
Output is correct |
6 |
Correct |
13 ms |
3080 KB |
Output is correct |
7 |
Correct |
23 ms |
2920 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
352 KB |
Not correct |
2 |
Halted |
0 ms |
0 KB |
- |