QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#834047 | #9237. Message | hansiyuan | 100 ✓ | 412ms | 4096kb | C++17 | 2.2kb | 2024-12-27 10:31:17 | 2024-12-27 10:31:19 |
Judging History
answer
#include "message.h"
#include<bits/stdc++.h>
using namespace std;
int n;
int tot=66;
bool B[100][31];
int pos[31];
// int cnt;
void get_nxt(int &k,vector<bool> C){
// cnt++;
if(pos[k]+1>=tot){
k++;
while(C[k]) k++;
}
else pos[k]++;
}
void send_message(vector<bool> A,vector<bool> C){
memset(pos,0,sizeof(pos));
memset(B,0,sizeof(B));
n = A.size();
for(int i=0;i<31;i++){
if(C[i]) continue;
int j = (i+1)%31;
while(C[j]) j=(j+1)%31;
pos[i] = (j-i+31)%31-1;
B[pos[i]++][i] = 1;
}
int k=0;
while(C[k]) k++;
for(int i=1024;i>n;i--){
B[pos[k]][k] = 0;
get_nxt(k,C);
}
B[pos[k]][k] = 1;
get_nxt(k,C);
for(int i=0;i<n;i++){
B[pos[k]][k] = A[i];
if(i<n-1) get_nxt(k,C);
}
vector<bool> p(31,0);
for(int i=0;i<tot;i++){
for(int j=0;j<31;j++)
p[j] = B[i][j];//,printf("%d ",B[i][j]);
// puts("");
send_packet(p);
}
}
bool flg;
int fa[31];
int stk[35],top;
vector<bool> C(31,0);
void dfs(int u){
if(pos[u]){
if(top-pos[u]+1==16){
flg=1;
for(int i=pos[u];i<=top;i++)
C[stk[i]]=0;
}
return;
}
stk[++top] = u;
pos[u] = top;
dfs(fa[u]);
}
vector<bool> res;
vector<bool> receive_message(vector<vector<bool>> A){
for(int i=0;i<31;i++){
fa[i]=0;
while(fa[i]<31 && A[fa[i]][i]==0) fa[i]++;
fa[i] += i+1;
fa[i] %= 31;
}
for(int i=0;i<31;i++) C[i]=1,pos[i]=0;
flg=top=0;
for(int i=0;i<31;i++)
if(!pos[i] && !flg) dfs(i);
for(int i=0;i<31;i++){
pos[i] = 0;
if(C[i]) continue;
pos[i] = (fa[i]-i+31)%31;
}
int k = 0;
while(C[k]) k++;
int n = 1024;
// cnt=0;
// for(int i=0;i<31;i++) cnt+=pos[i];
// cerr<<cnt<<endl;
while(!A[pos[k]][k]){
n--;
get_nxt(k,C);
}
get_nxt(k,C);
res.resize(n);
for(int i=0;i<n;i++){
res[i] = A[pos[k]][k];
get_nxt(k,C);
}
// cerr<<cnt<<endl;
// cerr<<pos[k]<<endl;
return res;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 281ms
memory: 3812kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #2:
score: 10
Accepted
time: 304ms
memory: 3816kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #3:
score: 10
Accepted
time: 305ms
memory: 4016kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #4:
score: 10
Accepted
time: 307ms
memory: 3812kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #5:
score: 10
Accepted
time: 205ms
memory: 3816kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #6:
score: 10
Accepted
time: 187ms
memory: 3792kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #7:
score: 10
Accepted
time: 171ms
memory: 3792kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Subtask #2:
score: 90
Accepted
Test #8:
score: 90
Accepted
time: 380ms
memory: 4080kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #9:
score: 90
Accepted
time: 394ms
memory: 3820kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #10:
score: 90
Accepted
time: 355ms
memory: 4008kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #11:
score: 90
Accepted
time: 298ms
memory: 4004kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #12:
score: 90
Accepted
time: 330ms
memory: 3756kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #13:
score: 90
Accepted
time: 256ms
memory: 3988kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #14:
score: 90
Accepted
time: 192ms
memory: 3984kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #15:
score: 90
Accepted
time: 258ms
memory: 3984kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #16:
score: 90
Accepted
time: 235ms
memory: 3756kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #17:
score: 90
Accepted
time: 310ms
memory: 3816kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #18:
score: 90
Accepted
time: 308ms
memory: 4008kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #19:
score: 90
Accepted
time: 338ms
memory: 3784kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #20:
score: 90
Accepted
time: 363ms
memory: 4084kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #21:
score: 90
Accepted
time: 325ms
memory: 3784kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #22:
score: 90
Accepted
time: 389ms
memory: 3804kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #23:
score: 90
Accepted
time: 293ms
memory: 3812kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #24:
score: 90
Accepted
time: 312ms
memory: 3800kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #25:
score: 90
Accepted
time: 364ms
memory: 3816kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #26:
score: 90
Accepted
time: 365ms
memory: 3820kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Test #27:
score: 90
Accepted
time: 412ms
memory: 4096kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
1
result:
points 1.0
Extra Test:
score: 0
Extra Test Passed