Submission #1099062

#TimeUsernameProblemLanguageResultExecution timeMemory
1099062LIAFlight to the Ford (BOI22_communication)C++17
0 / 100
12 ms332 KiB
#include "communication.h" #include <bits/stdc++.h> using namespace std; void encode(int N, int X) { vector<int> signals(250, 0); 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 (size_t i = 0; i < 3; ++i) { send(signals[i]); } } pair<int, int> decode(int N) { vector<int> receivedSignals(3); for (size_t 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}; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...