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