# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
600863 | alextodoran | Stranded Far From Home (BOI22_island) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/**
____ ____ ____ ____ ____
||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);
}