#include"communication.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<pii> vii;
void encode(int n, int x){
x--;
while(n>3){
return;
int a=1;
int l=0;
while(a<n){
a*=2;
l++;
}
//this is the log
//fib
}
if(x==0){
send(0);
send(0);
send(0);
send(0);
}
if(x==1){
send(0);
send(1);
send(1);
send(0);
}
if(x==2){
send(1);
send(0);
send(0);
send(1);
}
}
pii decode(int n){
while(n>3){
return {0, 0};
//
}
int a, b, c, d;
a=receive();
b=receive();
c=receive();
d=receive();
if(a==0 && b==1){
//1 0 not possible
return {2, 1};
}
if(a==1 && b==0){
return {1, 3};
}
if(a==1 && b==1){
return {2, 3};
}
if(c==1 && d==0){
//1 0 not possible
return {2, 1};
}
if(c==0 && d==1){
return {1, 3};
}
if(c==1 && d==1){
return {2, 3};
}
//now they are 0, 0 which means it can't be 0110
return {1, 3};
//a and b are 0. if I tried to send 1, that means
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |