# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
603909 | kostka | Flight to the Ford (BOI22_communication) | C++17 | 4 ms | 428 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
#include "communication.h"
using namespace std;
const string codes[3] = {"0000", "0110", "1111"};
void encode(int N, int X) {
assert(N <= 3);
for (auto c : codes[X-1]) send(c-'0');
}
std::pair<int, int> decode(int N) {
assert(N <= 3);
string received;
for (int i=0; i<4; i++) {
received += to_string(receive());
}
set <int> S = {1, 2, 3};
for (int i=0; i<3; i++) {
bool ok = false;
for (int j=0; j<2; j++) {
if (codes[i][j] != received[j] and codes[i][j+1] != received[j+1]) S.erase(i+1);
}
}
assert(S.size() <= 2);
vector <int> VS(S.begin(), S.end());
return {VS[0], VS[1%VS.size()]};
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |