Submission #860713

#TimeUsernameProblemLanguageResultExecution timeMemory
860713E869120Flight to the Ford (BOI22_communication)C++17
15 / 100
28 ms3532 KiB
#include"communication.h" #include <vector> using namespace std; void encode(int N, int X) { if (X == 1) { send(0); send(0); send(0); send(0); send(0); send(0); } if (X == 2) { send(1); send(1); send(1); send(1); send(1); send(1); } if (X == 3) { send(1); send(1); send(0); send(0); send(1); send(1); } } pair<int, int> decode(int N) { vector<int> List; List.push_back(receive()); List.push_back(receive()); List.push_back(receive()); List.push_back(receive()); List.push_back(receive()); List.push_back(receive()); // Check bool flag1 = true; bool flag2 = true; for (int i = 0; i < (int)List.size() - 1; i++) { if (List[i] == 1 && List[i + 1] == 1) flag1 = false; if (List[i] == 0 && List[i + 1] == 0) flag2 = false; } if (flag1 == false) return make_pair(2, 3); if (flag2 == false) return make_pair(1, 3); return make_pair(1, 2); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...