This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "message.h"
#include <bits/stdc++.h>
using namespace std;
void send_message(vector<bool> M,vector<bool> C) {
vector<vector<bool>> A(66, vector<bool> (31,0));
int x=1-M.back(),idx=0;
while(M.size()<=1024) M.push_back(x);
for(int i=0;i<31;i++){
if(!C[i]){
int j=(i+1)%31,ix=0;
while(C[j]){
ix++;
j=(j+1)%31;
}
A[ix][i]=1;
for(int j=ix+1;j<66;j++){
A[j][i]=M[idx];
idx++;
}
}
}
for(int i=0;i<66;i++) send_packet(A[i]);
}
vector<bool> receive_message(vector<vector<bool>> R) {
vector<int> nxt(31,0);
vector<bool> ans={};
for(int i=0;i<31;i++){
nxt[i]=(i+1)%31;
for(int j=0;j<66;j++){
if(!R[j][i]) nxt[i]=(nxt[i]+1)%31;
else break;
}
}
for(int i=0;i<31;i++){
int x=i;
for(int j=0;j<16;j++){
x=nxt[x];
}
if(x==i){
for(int j=(nxt[i]-i+31)%31;j<66;j++){
ans.push_back(R[j][i]);
}
}
}
int x=ans.back();
while(ans.back()==x) ans.pop_back();
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |