# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1123674 | math_rabbit_1028 | Message (IOI24_message) | C++20 | 0 ms | 0 KiB |
#include "message.h"
using namespace std;
vector<bool> add_blank(vector<bool> A, vector<bool> C) {
vector<bool> ret;
reverse(A.begin(), A.end());
for (int i = 0; i < 31; i++) {
if (C[i]) ret.push_back(0);
else {
ret.push_back(A.back());
A.pop_back();
}
}
assert(A.empty());
return ret;
}
void send_message(vector<bool> M, vector<bool> C) {
int S = (int)(M.size());
vector<bool> T(31, 1), F(31, 0);
for (int i = 0; i < 30; i++) {
if (C[i]) send_packet(T);
else send_packet(F);
}
for (int i = 0; i < S; i += 16) {
vector<bool> A(16, 0);
for (int j = 0; j < 16; j++) {
A[j] = (i+j < S) ? M[i+j] : 0;
}