QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#555454 | #9237. Message | tiger2005 | 100 ✓ | 235ms | 4112kb | C++23 | 2.2kb | 2024-09-09 23:29:02 | 2024-09-09 23:29:03 |
Judging History
answer
#include <vector>
#include <algorithm>
std::vector<bool> send_packet(std::vector<bool> A);
void send_message(std::vector<bool> M, std::vector<bool> C) {
int len = M.size();
M.resize(1025, false);
for (int i = len + 1; i < 1025; i ++)
M[i] = true;
std::vector<std::vector<bool>> occupied(66, std::vector<bool>(31, false));
std::vector<std::vector<bool>> transfer = occupied;
for (int i = 0; i < 31; i ++) if (!C[i]) {
int pos = (i + 1) % 31, x = 1;
while (C[pos])
pos = (pos + 1) % 31, ++ x;
for (int j = 0; j < x; j ++)
occupied[j][i] = true, transfer[j][i] = j == x - 1;
}
int cur = 0;
for (int i = 0; i < 31; i ++) if (!C[i])
for (int j = 0; j < 66; j ++) if (!occupied[j][i])
transfer[j][i] = M[cur ++];
for (auto packet: transfer)
send_packet(packet);
}
std::vector<bool> receive_message(std::vector<std::vector<bool>> R) {
std::vector<int> toward(31);
std::vector<bool> C(31, true);
for (int i = 0; i < 31; i ++)
for (int j = 0; j < 31; j ++) if (R[j][i]) {
toward[i] = (i + j + 1) % 31;
break;
}
{
std::vector<int> path, cycle;
std::vector<bool> vis(31);
for (int i = 0; i < 31; i ++) if (!vis[i]) {
path.clear();
int pos = i;
while (!vis[pos]) {
vis[pos] = true;
path.push_back(pos);
pos = toward[pos];
}
auto ptr = std::find(path.begin(), path.end(), pos);
if (path.end() - ptr == 16) {
for (int t = 0; t < 16; t ++)
cycle.push_back(*(ptr ++));
}
}
for (auto ele: cycle)
C[ele] = false;
}
std::vector<std::vector<bool>> occupied(66, std::vector<bool>(31, false));
for (int i = 0; i < 31; i ++) if (!C[i]) {
int pos = (i + 1) % 31, x = 1;
while (C[pos])
pos = (pos + 1) % 31, ++ x;
for (int j = 0; j < x; j ++)
occupied[j][i] = true;
}
std::vector<bool> info(1025);
int cur = 0;
for (int i = 0; i < 31; i ++) if (!C[i])
for (int j = 0; j < 66; j ++) if (!occupied[j][i])
info[cur ++] = R[j][i];
int len = 1024;
while (info[len])
len --;
info.resize(len);
return info;
}
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 193ms
memory: 4092kb
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: 188ms
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: 218ms
memory: 3992kb
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: 164ms
memory: 4020kb
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: 109ms
memory: 4020kb
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: 83ms
memory: 4096kb
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: 120ms
memory: 4020kb
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: 217ms
memory: 4024kb
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: 217ms
memory: 4024kb
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: 169ms
memory: 3800kb
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: 182ms
memory: 4092kb
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: 182ms
memory: 4036kb
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: 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: 101ms
memory: 3820kb
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: 132ms
memory: 4024kb
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: 100ms
memory: 3812kb
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: 188ms
memory: 4020kb
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: 177ms
memory: 4024kb
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: 235ms
memory: 3984kb
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: 174ms
memory: 4112kb
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: 163ms
memory: 4100kb
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: 200ms
memory: 3740kb
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: 148ms
memory: 3820kb
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: 199ms
memory: 3820kb
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: 221ms
memory: 3820kb
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: 181ms
memory: 3812kb
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: 187ms
memory: 3764kb
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