Submission #600873

# Submission time Handle Problem Language Result Execution time Memory
600873 2022-07-21T08:42:24 Z alextodoran Flight to the Ford (BOI22_communication) C++17
0 / 100
606 ms 1660 KB
/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

#include <bits/stdc++.h>
#include "communication.h"

using namespace std;

typedef long long ll;

int send (int s);
void encode (int N, int X) {
    while (N > 0) {
        if (send(1) == 0) {
            send(X % 2);
            N /= 2;
            X /= 2;
        }
    }
}

int receive ();
pair <int, int> decode (int N) {
    int X = 0;
    int bit = 0;
    while (N > 0) {
        if (receive() == 0) {
            X += (receive() << bit);
            N /= 2;
            bit++;
        }
    }
    return make_pair(X, X);
}
# Verdict Execution time Memory Grader output
1 Correct 12 ms 1600 KB Output is correct
2 Correct 14 ms 1640 KB Output is correct
3 Incorrect 3 ms 200 KB Not correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 606 ms 1660 KB Output is partially correct
2 Incorrect 4 ms 200 KB Not correct
3 Halted 0 ms 0 KB -