QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#580699 | #9237. Message | ljga_ | 100 ✓ | 221ms | 4088kb | C++20 | 1.6kb | 2024-09-21 23:13:45 | 2024-09-21 23:13:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#ifdef LOCAL
void send_packet(vector<bool> A);
#else
#include "message.h"
#endif
void send_message(vector<bool> M,vector<bool> C){
M.push_back(0);
while(M.size()<1025)
M.push_back(1);
vector<int> x(31);
vector<int> p;
for(int i=0;i<31;i++)
if(!C[i])
p.push_back(i);
for(int i=0;i<15;i++)
x[p[i]]=p[i+1]-p[i];
x[p[15]]=31+p[0]-p[15];
int pos=0;
for(int t=0;t<66;t++){
vector<bool> m(31);
for(auto i:p){
if(x[i]){
if(x[i]==1)
m[i]=1;
else
m[i]=0;
x[i]--;
}
else{
m[i]=M[pos++];
}
}
send_packet(m);
}
}
vector<bool> receive_message(vector<vector<bool> > R){
vector<bool> f(31);
vector<int> x(31);
for(int t=0;t<66;t++){
for(int i=0;i<31;i++)
if(!f[i]){
x[i]++;
if(R[t][i])
f[i]=1;
}
}
vector<bool> c(31,1);
for(int i=0;i<31;i++){
vector<bool> vis(31);
int cnt=0;
for(int u=i;!vis[u];u=(u+x[u])%31){
vis[u]=1;
cnt++;
}
if(cnt==16){
for(int u=i;cnt--;u=(u+x[u])%31)
c[u]=0;
break;
}
}
vector<bool> m;
for(int t=0;t<66;t++){
for(int i=0;i<31;i++){
if(!c[i]){
if(x[i])
x[i]--;
else
m.push_back(R[t][i]);
}
}
}
while(m.back())
m.pop_back();
m.pop_back();
return m;
}
#ifdef LOCAL
vector<vector<bool> > m;
void send_packet(vector<bool> a){
m.push_back(a);
}
int main(){
send_message({0,1,1,0,1,0,1,1},{0,0,0,0,1,1,1,1,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,1,1,1,1,0,1,1,0});
auto res=receive_message(m);
for(auto t:res)
cout<<t<<' ';
cout<<endl;
return 0;
}
#endif
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 157ms
memory: 3808kb
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: 152ms
memory: 3820kb
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: 136ms
memory: 3812kb
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: 141ms
memory: 4040kb
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: 110ms
memory: 4088kb
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: 81ms
memory: 3812kb
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: 121ms
memory: 3684kb
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: 168ms
memory: 4012kb
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: 138ms
memory: 3744kb
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: 4016kb
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: 122ms
memory: 3812kb
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: 172ms
memory: 3808kb
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: 70ms
memory: 3736kb
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: 54ms
memory: 3808kb
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: 156ms
memory: 3756kb
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: 111ms
memory: 3816kb
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: 170ms
memory: 3824kb
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: 145ms
memory: 4016kb
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: 109ms
memory: 3812kb
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: 155ms
memory: 3992kb
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: 3820kb
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: 149ms
memory: 3812kb
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: 164ms
memory: 4084kb
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: 180ms
memory: 3728kb
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: 171ms
memory: 3824kb
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: 221ms
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: 156ms
memory: 3976kb
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