This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include"communication.h"
#include<bits/stdc++.h>
using namespace std;
void encode(int N, int X){
vector<int> val={0,9,18,36};
for(int i=0;i<6;i++)send(val[X]>>i&1);
}
pair<int, int> decode(int N) {
vector<vector<int>> vec(64);
vector<int> val={0,9,18,36};
vector<int> res;
for(int i=0;i<64;i++){
bool ok=true;
for(int j=0;j<5;j++){
ok&=(i>>j&3)!=3;
}
if(ok){
res.emplace_back(i);
}
}
int num=0;
for(int i=0;i<6;i++)num|=receive()<<i;
for(int i=1;i<=N;i++){
for(auto x:res){
vec[val[i]^x].emplace_back(i);
}
}
if(vec[num].empty())exit(1);
while(vec[num].size()<2)vec[num].emplace_back(1);
return {vec[num][0],vec[num][1]};
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |