Submission #1205873

#TimeUsernameProblemLanguageResultExecution timeMemory
1205873lightonFlight to the Ford (BOI22_communication)C++20
15 / 100
14 ms2936 KiB
#include"communication.h" #include<bits/stdc++.h> #define pb push_back #define all(v) v.begin(),v.end() #define forf(i,s,e) for(int i = s; i<=e; i++) #define forb(i,s,e) for(int i = s; i>=e; i--) #define idx(i,v) lower_bound(all(v),i)-v.begin() #define comp(v) v.erase(unique(all(v)),v.end()) #define sz(v) (int)v.size() #define fs first #define se second #define SP << " " << #define LN << "\n" #define IO cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false); using namespace std; typedef long long ll; ll inf = 1e18; vector<int> message[3] = {{0,0,0,0,0}, {0,1,1,0,1}, {1,1,1,1,1}}; void encode(int N, int X) { int trash; forf(i,0,4) trash = send(message[X-1][i]); } std::pair<int, int> decode(int N) { vector<int> ans; vector<int> R; forf(i,0,4) R.pb(receive()); forf(x,0,2){ int f = 1; forf(i,0,3) if(R[i]!=message[x][i] && R[i+1]!=message[x][i+1]) f = 0; if(f) ans.pb(x+1); } assert(sz(ans) <= 2); if(sz(ans) == 1) return {ans[0], ans[0]}; else return {ans[0], ans[1]}; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...