Submission #1322998

#TimeUsernameProblemLanguageResultExecution timeMemory
1322998NValchanovFlight to the Ford (BOI22_communication)C++20
0 / 100
8 ms2704 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(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, 3};
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...