QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#601002 | #9237. Message | Pittow | 0 | 175ms | 4012kb | C++17 | 1.2kb | 2024-09-29 20:29:55 | 2024-09-29 20:29:57 |
Judging History
answer
#include "message.h"
typedef std::vector<bool> arr;
typedef std::vector<arr> arr2;
bool d[31],e[31],f[31];//d:decode e,f:encode
int r[31];//point
void encode(int p){
if(r[p]!=-1)return;
int l=(p+1)%31;
while(l!=p&&!d[l])encode(l),l=r[l];
if(l==p)return;
(++l)%=31;
r[p]=l;
}
int flag;
int decode(int p){//return end
if(!d[p])return p;
d[p]=0;
int l=(p+1)%31;
if(!f[p])l=decode(l);
if(l==p)return flag=0,p;
(++l)%=31;
r[p]=l;
if(!e[p])return decode(l);
return l;
}
bool check(int p){
int i,j;
for(i=0;i<31;++i)d[i]=1,r[i]=-1;
flag=1;
decode(p);
for(i=j=0;i<31;++i)if(!d[i])++j;
if(j!=16)return 1;
return flag;
}
void send_message(arr M,arr C){
int i,j;
arr A(31);
for(i=0;i<31;++i)A[i]=C[(i+1)%31];
send_packet(A);
for(i=0;i<31;++i)r[i]=-1,d[i]=C[i];
for(i=0;i<31;++i)if(!d[i]&&r[i]==-1)encode(i);
for(i=0;i<31;++i)if(r[i]!=-1)A[i]=C[r[i]];
send_packet(A);
for(i=0;i<M.size();){
for(j=0;j<31;++j)if(!C[j])A[j]=M[i++];
send_packet(A);
}
}
arr receive_message(arr2 R){
int s=R.size(),i,j,k;
arr A((s-2)*16);
for(i=0;i<31;++i)e[i]=R[1][i],f[i]=R[0][i];
for(i=0;check(i);++i);
for(i=2,k=0;i<s;++i)
for(j=0;j<31;++j)if(!d[j])A[k++]=R[i][j];
return A;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 10
Accepted
time: 6ms
memory: 3748kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #2:
score: 0
Wrong Answer
time: 30ms
memory: 4012kb
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: 90
Accepted
time: 175ms
memory: 3752kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #9:
score: 0
Wrong Answer
time: 97ms
memory: 4000kb
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