답안 #850357

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
850357 2023-09-16T12:31:25 Z MinaRagy06 Flight to the Ford (BOI22_communication) C++17
0 / 100
439 ms 2968 KB
#include <bits/stdc++.h>
#include "communication.h"
#ifdef MINA
#include "grader.cpp"
#endif
using namespace std;

int ask(int x) {
    int ret = send(x);
    return ret;
}
const int m = 100;
void encode(int n, int x) {
    mt19937 rng(2006);
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < m; j++) {
            ask((rng() & 1) ^ ((x >> i) & 1));
        }
        while (ask(1) != 1);
    }
}

pair<int, int> decode(int n) {
    int a[2][m]{};
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < m; j++) {
            a[i][j] = receive();
        }
        while (receive() != 1);
    }
    int ans = 0;
    mt19937 rng(2006);
    for (int i = 0; i < 2; i++) {
        int v[m];
        for (int j = 0; j < m; j++) {
            v[j] = (rng() & 1);
        }
        int lst = 0, bit = 0;
        for (int j = 0; j < m; j++) {
            if (a[i][j] != v[j]) {
                if (lst) {
                    bit = 1;
                    break;
                }
                lst = 1;
            } else {
                lst = 0;
            }
        }
        ans |= bit << i;
    }
    return {ans, ans};
}
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 2968 KB Output is correct
2 Correct 156 ms 2888 KB Output is correct
3 Correct 191 ms 2744 KB Output is correct
4 Incorrect 46 ms 352 KB Not correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 439 ms 332 KB Not correct
2 Halted 0 ms 0 KB -