Submission #583968

#TimeUsernameProblemLanguageResultExecution timeMemory
583968cheissmartFlight to the Ford (BOI22_communication)C++17
0 / 100
1 ms236 KiB
#include"communication.h" #include <bits/stdc++.h> #define IO_OP ios::sync_with_stdio(0), cin.tie(0) #define F first #define S second #define V vector #define PB push_back #define EB emplace_back #define MP make_pair #define SZ(v) int((v).size()) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef V<int> vi; const int INF = 1e9 + 7; vi aux({1, 2, 3, 4, 5, 6, 7, 5, 1, 2, 3, 4, 5}); vi aux2({1, 2, 3, 4, 5, 6, 7, 5, 1, 2, 3, 4, 5}); void encode(int n, int x) { for(int i = 0; i < SZ(aux); i++) { for(int j = 0; j < aux[i]; j++) { if(send(0)) { send(x > 1); return; } } for(int j = 0; j < aux2[i]; j++) send(x); } } std::pair<int, int> decode(int n) { int cnt[2] = {}; for(int i = 0; i < SZ(aux); i++) { for(int j = 0; j < aux[i]; j++) { if(receive()) { int x = receive(); return {x + 1, x + 2}; } } for(int j = 0; j < aux2[i]; j++) cnt[receive()]++; } if(cnt[0] > cnt[1]) return {1, 2}; else return {2, 3}; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...