QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#555496 | #9237. Message | bachbeo2007 | 100 ✓ | 205ms | 4092kb | C++23 | 1.2kb | 2024-09-10 01:09:25 | 2024-09-10 01:09:25 |
Judging History
answer
#include "message.h"
#include<bits/stdc++.h>
using namespace std;
const int S = 66;
const int N = 31;
void send_message(std::vector<bool> M, std::vector<bool> C) {
vector<int> d(N);
for(int i=0;i<N;i++){
if(C[i]) continue;
d[i]=1;
while(C[(i+d[i])%N]) d[i]++;
}
int x=0;
for(int i=0;i<S;i++){
vector<bool> A(N);
for(int j=0;j<N;j++){
if(C[j]) continue;
if(i<d[j]) A[j]=(i==d[j]-1);
else if(x<(int)M.size()) A[j]=M[x++];
else A[j]=!M.back();
}
send_packet(A);
}
}
std::vector<bool> receive_message(std::vector<std::vector<bool>> R) {
vector<bool> C(N,true);
vector<int> d(N);
for(int i=0;i<N;i++){
for(int j=0;j<S;j++){
if(R[j][i]){
d[i]=j+1;
break;
}
}
}
for(int i=0;i<N;i++){
vector<bool> vis(N,false);
int u=i,cnt=0;
while(!vis[u]){
vis[u]=true;
u=(u+d[u])%N;
cnt++;
}
if(u==i && cnt==16) C[i]=false;
}
vector<bool> M;
for(int i=0;i<S;i++){
for(int j=0;j<N;j++){
if(C[j] || i<d[j]) continue;
else M.push_back(R[i][j]);
}
}
bool T=M.back();
while(M.back()==T) M.pop_back();
return M;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 168ms
memory: 4000kb
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: 144ms
memory: 3728kb
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: 108ms
memory: 3728kb
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: 159ms
memory: 3816kb
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: 129ms
memory: 4092kb
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: 109ms
memory: 4012kb
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: 79ms
memory: 3980kb
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: 143ms
memory: 3816kb
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: 189ms
memory: 4004kb
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: 139ms
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: 160ms
memory: 3728kb
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: 142ms
memory: 3976kb
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: 79ms
memory: 3788kb
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: 86ms
memory: 4092kb
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: 105ms
memory: 3752kb
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: 120ms
memory: 3804kb
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: 162ms
memory: 3724kb
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: 164ms
memory: 3800kb
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: 160ms
memory: 3972kb
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: 165ms
memory: 4092kb
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: 140ms
memory: 3812kb
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: 116ms
memory: 3732kb
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: 159ms
memory: 3808kb
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: 169ms
memory: 3836kb
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: 147ms
memory: 4020kb
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: 160ms
memory: 3808kb
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: 205ms
memory: 3796kb
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