#include"communication.h"
#include <vector>
using namespace std;
void encode(int N, int X)
{
if(X == 1)
{
send(0);
send(0);
send(0);
send(0);
}
else if(X == 2)
{
send(1);
send(1);
send(1);
send(1);
}
else
{
send(0);
send(1);
send(1);
send(0);
}
}
std::pair<int, int> decode(int N)
{
vector < int > v;
v.push_back(receive());
v.push_back(receive());
v.push_back(receive());
v.push_back(receive());
bool has11 = false;
for(int i = 1; i < 4; i++)
{
if(v[i - 1] == 1 && v[i] == 1)
has11 = true;
}
if(has11)
return {2, 3};
return {1, 1};
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |