QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#562728 | #9237. Message | 0000pnc | 100 ✓ | 209ms | 4096kb | C++20 | 1.8kb | 2024-09-13 20:19:10 | 2024-09-13 20:19:10 |
Judging History
answer
#include <bits/stdc++.h>
#include "message.h"
using namespace std;
void send_message(vector<bool> M, vector<bool> C) {
vector<int> pos, d(31, 0);
vector<vector<bool> > all(66, vector<bool>(31, 0));
for (int i = 0; i < 31; i++) {
if (!C[i]) pos.push_back(i);
}
for (int i = 0; i < 15; i++) d[pos[i]] = pos[i + 1] - pos[i];
d[pos[15]] = pos[0] + 31 - pos[15];
// for (int i = 0; i < 31; i++) printf("[%d] ", d[i]);
vector<bool> msg;
for (bool x : M) msg.push_back(x);
msg.push_back(true);
while (msg.size() != 1025) msg.push_back(false);
for (int i = 0, cur = 0; i < 66; i++) {
for (int j = 0; j < 31; j++) {
if (!C[j]) {
if (i < d[j]) {
if (i == d[j] - 1) all[i][j] = 1;
else all[i][j] = 0;
}
else all[i][j] = msg[cur++];
}
}
}
for (int i = 0; i < 66; i++) {
vector<bool> useless = send_packet(all[i]);
}
}
vector<bool> receive_message(vector<vector<bool> > R) {
vector<int> d(31, 0), to(31, 0);
for (int i = 0; i < 31; i++) {
for (int j = 0; j < 66; j++) {
if (R[j][i]) { d[i] = j + 1; break; }
}
d[i] = min(d[i], 31);
to[i] = (i + d[i]) % 31;
}
vector<bool> vis(31, false), vis2(31, false), is(31, false);
// for (int i = 0; i < 31; i++) printf("[%d] ", to[i]);
for (int i = 0; i < 31; i++) {
if (!vis2[i]) {
int cnt = 0, res = to[i]; vis2[i] = 1;
while (!vis2[res]) vis2[res] = 1, res = to[res];
while (!is[res]) is[res] = 1, res = to[res], cnt++;
if (cnt == 16) {
while (!vis[res]) vis[res] = 1, res = to[res];
}
}
}
// for (int i = 0; i < 31; i++) if (vis[i]) printf("{%d}\n", i);
vector<bool> msg;
for (int i = 0; i < 66; i++) {
for (int j = 0; j < 31; j++) {
if (vis[j] && i >= d[j]) {
msg.push_back(R[i][j]);
}
}
}
while (msg.back() != true) msg.pop_back();
msg.pop_back(); return msg;
}
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 174ms
memory: 4020kb
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: 209ms
memory: 4020kb
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: 175ms
memory: 4012kb
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: 126ms
memory: 3808kb
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: 117ms
memory: 4096kb
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: 89ms
memory: 3820kb
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: 94ms
memory: 3984kb
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: 172ms
memory: 3812kb
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: 173ms
memory: 4020kb
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: 190ms
memory: 3736kb
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: 177ms
memory: 3808kb
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: 156ms
memory: 4020kb
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: 141ms
memory: 4020kb
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: 103ms
memory: 4020kb
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: 102ms
memory: 3824kb
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: 137ms
memory: 3796kb
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: 161ms
memory: 3792kb
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: 144ms
memory: 4092kb
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: 189ms
memory: 3824kb
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: 183ms
memory: 3760kb
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: 169ms
memory: 4016kb
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: 176ms
memory: 3988kb
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: 137ms
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: 175ms
memory: 3752kb
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: 124ms
memory: 4096kb
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: 177ms
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: 169ms
memory: 4020kb
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