# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
614259 | Plurm | Flight to the Ford (BOI22_communication) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "communication.h"
#include <bits/stdc++.h>
using namespace std;
void sentbit(int bit) {
for (int i = 0; i < 100; i++)
send(bit);
}
void encode(int N, int X) {
// N = 3
if (X == 2)
sendbit(1);
else
sendbit(0);
}
int recbit() {
int cnt[2];
cnt[0] = cnt[1] = 0;
for (int i = 0; i < 100; i++) {
cnt[receive()]++;
}
return cnt[0] > cnt[1] ? 0 : 1;
}
std::pair<int, int> decode(int N) { return {1, (recbit() ? 2 : 3)}; }