Submission #666298

#TimeUsernameProblemLanguageResultExecution timeMemory
666298mychecksedadFlight to the Ford (BOI22_communication)C++17
0 / 100
62 ms200 KiB
#include <utility> #include <bits/stdc++.h> using namespace std; /** * use this function in encode when you want to send a certain signal * (it might come out wrong, and the return value tells you which signal * was actually sent) */ int send(int); /** * use this function in decode; it returns the next signal that was actually * sent during the corresponding call of encode */ int receive(); /** * implement these two functions yourself */ void encode(int N, int X){ for(int j = 0; j < 3; ++j){ for(int k = 0; k < 5; ++k){ send(((1<<j)&X)>0); } } } std::pair<int, int> decode(int N) { int a = 0; for(int j = 0; j < 3; ++j){ int x = 0, y = 0; for(int k = 0; k < 5; ++k){ bool b = receive(); x += b; y += !b; } if(x>y) a += (1<<j); } return {a, a}; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...