# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1099056 | LIA | Flight to the Ford (BOI22_communication) | C++17 | 10 ms | 372 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "communication.h"
using namespace std;
void encode(int N, int X) {
int signals[5];
int response[5];
if (X == 1) {
signals[0] = 0;
signals[1] = 0;
signals[2] = 0;
} else if (X == 2) {
signals[0] = 0;
signals[1] = 1;
signals[2] = 0;
} else if (X == 3) {
signals[0] = 1;
signals[1] = 0;
signals[2] = 0;
}
for (int i = 0; i < 3; ++i) {
response[i] = send(signals[i]);
}
}
pair<int, int> decode(int N) {
int receivedSignals[3];
for (int i = 0; i < 3; ++i) {
receivedSignals[i] = receive();
}
if (receivedSignals[0] == 0 && receivedSignals[1] == 0) {
return {1, 2};
} else if (receivedSignals[0] == 0 && receivedSignals[1] == 1) {
return {2, 3};
} else if (receivedSignals[0] == 1 && receivedSignals[1] == 0) {
return {3, 1};
} else {
return {1, 1};
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |