Submission #651141

#TimeUsernameProblemLanguageResultExecution timeMemory
651141TimDeeFlight to the Ford (BOI22_communication)C++17
0 / 100
675 ms1740 KiB
#include"communication.h" #include <bits/stdc++.h> using namespace std; const int PAIU=100; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int rand(int a, int b) { return a+rng()%(b-a+1); } pair<int,int> decode(int n) { for (int i=0; i<PAIU; ++i) { int f=receive(); int s=receive(); if (f==1 && s==1) continue; if (f==1 && s==0) return {1,3}; if (f==0 && s==1) return {2,3}; if (f==0 && s==0) return {1,2}; } vector<int> paiu = {1,2,3}; shuffle(paiu.begin(), paiu.end(), rng); return {paiu[0],paiu[1]}; } void encode(int n, int x) { for (int i=0; i<PAIU; ++i) { if (x&1) send(1); else send(0); if (x&2) send(1); else send(0); } if (x==3) { int v=send(1); if (v) send(0); else send(1); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...