#include <bits/stdc++.h>
#include"communication.h"
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvl = vector<vll>;
using pll = pair<ll,ll>;
using vpl = vector<pll>;
using vvp = vector<vpl>;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(),v.end()
// g++ -std=c++17 communication_sample.cpp sample_grader.cpp
// as ./a.exe
void encode(int n, int x) {
ll a, b, c;
if(x==1){
a=send(0);
b=send(0);
c=send(0);
if(a==0 && b==1 && c==0){
send(0);
send(0);
send(0);
}
}
if(x==2){
a=send(0);
b=send(1);
c=send(1);
if(a==0 && b==1 && c==0){
send(0);
send(1);
send(1);
}
}
if(x==3){
a=send(1);
b=send(1);
c=send(1);
if(a==0 && b==1 && c==0){
send(1);
send(1);
send(1);
}
}
}
std::pair<int, int> decode(int N) {
ll a, b, c;
a=receive();
b=receive();
c=receive();
if(a+b+c==3)return {2,3};
if(a+b+c==0)return {1,2};
if(a==1 && c==1)return {1,3};
if(a+b+c==2)return {2,3};
if(b!=1)return {1,2};
a=receive();
b=receive();
c=receive();
if(a+b+c==3)return {2,3};
if(a+b+c==0)return {1,2};
if(a==1 && c==1)return {1,3};
if(a+b+c==2)return {2,3};
if(b!=1)return {1,2};
return {1,2};
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |