QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#818953 | #9237. Message | hansiyuan# | 0 | 232ms | 3824kb | C++17 | 2.0kb | 2024-12-18 11:07:10 | 2024-12-18 11:07:10 |
Judging History
answer
#include "message.h"
#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(time(0));
bool flg=0;
int n,m=30;
vector<bool> T;
vector<bool> A;
bool hsh[17][32];
bool C[32];
void send_message(vector<bool> S,vector<bool> C){
n = S.size();
if(!flg){
for(int i=1;i<=16;i++){
for(int j=1;j<=m;j++)
hsh[i][j] = rnd()%2;
}
flg=1;
}
A.resize(31);
for(int i=1;i<=m;i++){
for(int j=0,k=1;j<=30;j++){
if(C[j]) A[j] = 0;
else{
A[j] = hsh[k][i];
k++;
}
}
send_packet(A);
}
for(int j=0,k=0;j<=30;j++){
if(C[j]) A[j]=0;
else A[j] = n>>k&1, k++;
}
// for(int j=0;j<=30;j++) cerr<<A[j]<<' '; cerr<<endl;
send_packet(A);
for(int i=1,k=0;i<=(n+15)/16;i++){
for(int j=0;j<=30;j++){
if(C[j] || k==n) A[j] = 0;
else A[j] = S[k++];
}
// for(int j=0;j<=30;j++) cerr<<A[j]<<' '; cerr<<endl;
send_packet(A);
}
}
vector<bool> receive_message(vector<vector<bool>> R){
// for(int i=1;i<=16;i++){
// for(int j=1;j<=m;j++) cerr<<hsh[i][j]<<' ';
// cerr<<endl;
// }cerr<<endl;
// for(int j=0;j<=30;j++){
// for(int i=0;i<m;i++) cerr<<R[i][j]<<' ';
// cerr<<endl;
// }
for(int j=0,id=1;j<=30;j++){
bool flag=1;
for(int i=0;i<m;i++){
if(R[i][j] != hsh[id][i+1]) {flag=0; break;}
}
if(flag && id<=16) C[j]=0,id++;
else C[j]=1;
}
// cerr<<"receive"<<endl;
// for(int j=0;j<=30;j++) cerr<<C[j]<<' '; cerr<<endl;
int n = 0;
for(int j=0,k=0;j<=30;j++){
if(C[j]) continue;
n |= (1<<k)*R[m][j];
k++;
}
// cerr<<n<<endl;
T.resize(n);
for(int i=m+1,k=0;i<R.size();i++){
for(int j=0;j<=30;j++){
if(C[j] || k==n) continue;
T[k++] = R[i][j];
}
}
return T;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 71ms
memory: 3812kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
0 ing with message 'decoded message is incorrect' Sending secret with code DIE to mgr2sol[1] Quitting with result code 1
result:
wrong output format Extra information in the output file
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 232ms
memory: 3824kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
0 ing with message 'decoded message is incorrect' Sending secret with code DIE to mgr2sol[1] Quitting with result code 1
result:
wrong output format Extra information in the output file