Submission #925213

#TimeUsernameProblemLanguageResultExecution timeMemory
925213dranjohnFlight to the Ford (BOI22_communication)C++17
15 / 100
26 ms3208 KiB
#include "communication.h" #include <iostream> void encode(int N, int X) { --X; if (N > 3) return; int position = 0; int depth = 0; while (depth < 2) { int intent = 0; if (position != (X + 2) % 3) intent = 1; if (send(intent) == 0) { ++position; position %= 3; } else ++depth; } // std::cerr << "Finish on position " << position << '\n'; } std::pair<int, int> decode(int N) { int position = 0; int depth = 0; while (depth < 2) { if (receive() == 0) { ++position; position %= 3; } else ++depth; } // std::cerr << "Finish on position " << position << '\n'; return { position + 1, (position + 2) % 3 + 1 }; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...