Submission #574150

#TimeUsernameProblemLanguageResultExecution timeMemory
574150eecsFlight to the Ford (BOI22_communication)C++17
15 / 100
41 ms1820 KiB
#include "communication.h" #include <bits/stdc++.h> using namespace std; void encode(int n, int x) { assert(n == 3); if (x == 1) send(0), send(0), send(0), send(0); if (x == 2) send(0), send(1), send(1), send(0); if (x == 3) send(1), send(1), send(1), send(1); } pair<int, int> decode(int n) { assert(n == 3); vector<int> V, cand; vector<int> a[3] = {{0, 0, 0, 0}, {0, 1, 1, 0}, {1, 1, 1, 1}}; for (int i = 0; i < 4; i++) V.push_back(receive()); for (int i = 0; i < 3; i++) { int lst = -2; bool flag = 1; for (int j = 0; j < 4; j++) if (V[j] ^ a[i][j]) { if (lst == j - 1) flag = 0; lst = j; } if (flag) cand.push_back(i + 1); } return {cand[0], cand[cand.size() == 1 ? 0 : 1]}; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...