Submission #1323059

#TimeUsernameProblemLanguageResultExecution timeMemory
1323059NValchanovFlight to the Ford (BOI22_communication)C++20
15 / 100
14 ms2844 KiB
#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(0);
        send(0);
        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());

    if(v[1] == v[2])
    {
        if(v[1] == 1)
            return {3, 3};
        
        return {1, 2};
    }

    if(v[0] == v[3])
    {
        if(v[0] == 1)
            return {2, 2};

        return {1, 3};
    }

    if(v[0] == v[1])
        return {2, 3};

    return {1, 1};
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...