QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#818953#9237. Messagehansiyuan#0 232ms3824kbC++172.0kb2024-12-18 11:07:102024-12-18 11:07:10

Judging History

你现在查看的是最新测评结果

  • [2024-12-18 11:07:10]
  • 评测
  • 测评结果:0
  • 用时:232ms
  • 内存:3824kb
  • [2024-12-18 11:07:10]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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