Submission #614261

#TimeUsernameProblemLanguageResultExecution timeMemory
614261PlurmFlight to the Ford (BOI22_communication)C++17
0 / 100
364 ms1684 KiB
#include "communication.h" #include <bits/stdc++.h> using namespace std; void sendbit(int bit) { for (int i = 0; i < 100; i++) send((i % 2) ^ bit); } void encode(int N, int X) { // N = 3 if (X == 2) sendbit(1); else sendbit(0); } int recbit() { int cnt[2]; cnt[0] = cnt[1] = 0; for (int i = 0; i < 100; i++) { cnt[receive() ^ (i % 2)]++; } return cnt[0] > cnt[1] ? 0 : 1; } std::pair<int, int> decode(int N) { return {1, (recbit() ? 2 : 3)}; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...