Submission #1038805

# Submission time Handle Problem Language Result Execution time Memory
1038805 2024-07-30T07:50:02 Z thinknoexit Flight to the Ford (BOI22_communication) C++17
15 / 100
20 ms 2824 KB
#include"communication.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

void encode(int N, int X) {
    int x = X;
    int f = (3 ^ x) & 2;
    if (f == 0) {
        if (send(0) == 0) {
            if (send(0)) send((x & 1) ^ 1);
        }
        else {
            send((x & 1) ^ 1);
        }
    }
    else {
        if (send(1) == 1) send(0);
        else {
            send(1), send(0);
        }
    }
}
pair<int, int> ex[4] = { {0,0}, {2, 3}, {1, 3}, {1, 2} };
pair<int, int> decode(int N) {
    int val = 0;
    if (receive()) {
        val = 2 + receive();
        return ex[val];
    }
    if (!receive()) return ex[1];
    return ex[2 + receive()];
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2744 KB Output is correct
2 Correct 5 ms 2752 KB Output is correct
3 Correct 7 ms 2740 KB Output is correct
4 Correct 10 ms 2744 KB Output is correct
5 Correct 10 ms 2736 KB Output is correct
6 Correct 10 ms 2824 KB Output is correct
7 Correct 20 ms 2744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 332 KB Not correct
2 Halted 0 ms 0 KB -