QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#844445 | #9237. Message | nodgd | 100 ✓ | 261ms | 4132kb | C++20 | 2.0kb | 2025-01-05 22:02:52 | 2025-01-05 22:02:53 |
Judging History
answer
#include <cstdio>
#include <vector>
#include <assert.h>
#include "message.h"
using namespace std;
vector<bool> send_packet(vector<bool> A);
void send_message(vector<bool> M, vector<bool> C) {
M.push_back(0);
M.resize(1025, 1);
int m = M.size();
int n = C.size();
assert(m == 1025);
assert(n == 31);
vector<int> f(n, 0);
for (int p = 0; p < n; p ++) {
if (!C[p]) {
int &d = f[p] = 1;
for (; C[(p + d) % n]; d ++);
}
}
int Q = 66;
vector<vector<bool>> A(Q, vector<bool>(n, 0));
for (int i = 0, j = 0; i < Q; i ++) {
for (int p = 0; p < n; p ++) {
if (!C[p]) {
if (i == f[p] - 1) {
A[i][p] = 1;
} else if (i >= f[p] && j < m) {
A[i][p] = M[j ++];
}
}
}
send_packet(A[i]);
}
}
vector<bool> receive_message(vector<vector<bool>> R){
int Q = R.size(), n = R[0].size();
assert(Q == 66);
assert(n == 31);
vector<int> f(n, 0), v(n, 0), d(n, 0);
for (int p = 0; p < n; p ++) {
int &i = f[p] = 0;
for (; i < n && !R[i][p]; i ++);
f[p] = (p + i + 1) % n;
}
for (int p = 0; p < n; p ++) {
int q = p, k = 1;
for (; !v[q]; q = f[q]) {
v[q] = 1, d[q] = k ++;
}
if (k - d[q] != 16) continue;
for (; v[q] == 1; q = f[q]) {
v[q] = 2;
}
break;
}
for (int p = 0; p < n; p ++) {
if (v[p] == 2) {
int &d = f[p] = 1;
for (; v[(p + d) % n] != 2; d ++);
}
}
vector<bool> M(1025, 0);
for (int i = 0, j = 0; i < Q; i ++) {
for (int p = 0; p < n; p ++) {
if (v[p] == 2 && i >= f[p]) {
M[j ++] = R[i][p];
}
}
}
for (n = M.size() - 1; M[n]; n --);
M.resize(n);
return M;
}
詳細信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 181ms
memory: 4056kb
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: 168ms
memory: 3780kb
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: 161ms
memory: 3776kb
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: 166ms
memory: 4028kb
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: 3824kb
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: 91ms
memory: 3768kb
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: 154ms
memory: 3860kb
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: 178ms
memory: 3860kb
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: 191ms
memory: 4128kb
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: 124ms
memory: 3768kb
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: 153ms
memory: 3784kb
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: 197ms
memory: 4056kb
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: 133ms
memory: 3824kb
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: 101ms
memory: 3776kb
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: 128ms
memory: 3776kb
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: 158ms
memory: 4124kb
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: 205ms
memory: 4032kb
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: 186ms
memory: 4132kb
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: 222ms
memory: 4032kb
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: 121ms
memory: 3828kb
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: 210ms
memory: 4060kb
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: 164ms
memory: 3832kb
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: 261ms
memory: 4060kb
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: 3828kb
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: 182ms
memory: 3784kb
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: 155ms
memory: 3864kb
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: 157ms
memory: 3776kb
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