Submission #1178794

#TimeUsernameProblemLanguageResultExecution timeMemory
1178794IskachunFlight to the Ford (BOI22_communication)C++20
0 / 100
7 ms2716 KiB
#include<vector>
#include<cstdio>
#include<set>
#include<cstdlib>
#include<cstdarg>
#include<cassert>
using namespace std;

#include "communication.h"


void encode(int N, int x) {
    if (x == 1) {
        int a = send(0), b = send(0);
        while (a or b) a = b, b = send(0);
    } else {
        int a = send(1), b = send(1);
        while (!a or !b) a = b, b = send(1);
    }
}

pair<int, int> decode(int N) {
    int a = receive(), b = receive();
    while ((a and !b) or (!a and b)) a = b, b = receive();
    if (a and b) return {2, 3};
    else return {1, 2};
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...