#include "message.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ari2 = array<int, 2>;
using ari3 = array<int, 3>;
using arl2 = array<ll, 2>;
using arl3 = array<ll, 3>;
template <class T> using vt = vector<T>;
#define all(x) begin(x), end(x)
#define size(x) (int((x).size()))
#define REP(a,b,c,d) for(int a=(b);(d)>0?a<=(c):a>=(c);a+=(d))
#define FOR(a,b,c) REP(a,b,c,1)
#define ROF(a,b,c) REP(a,b,c,-1)
void send_message(vt<bool> M, vt<bool> C) {
FOR(i, 0, 30)
send_packet(vt<bool>(31, C[i]));
vt<int> good;
FOR(i, 0, 30)
if (!C[i])
good.push_back(i);
vt<bool> vv(31);
FOR(i, 0, size(good)-1)
vv[good[i]] = size(M) >> i & 1;
send_packet(vv);
REP(i, 0, size(M)-1, 16) {
vt<bool> v(31);
FOR(j, 0, min(15, size(M)-i))
v[good[j]] = M[i + j];
send_packet(v);
}
}
vt<bool> receive_message(vt<vt<bool>> R) {
vt<int> good;
FOR(i, 0, 30)
if (count(all(R[i]), 1) < 16)
good.push_back(i);
int sz = 0;
FOR(i, 0, size(good)-1)
sz |= R[31][i] << i;
vt<bool> ret;
FOR(i, 32, size(R) - 1)
for (const auto &j : good)
if (size(ret) < sz)
ret.push_back(R[i][j]);
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |