#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 && i!=nxt[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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
656 KB |
Used 66 days |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1134 ms |
420 KB |
decoded message is incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
656 KB |
Used 66 days |
2 |
Incorrect |
1134 ms |
420 KB |
decoded message is incorrect |
3 |
Halted |
0 ms |
0 KB |
- |