QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#562676 | #9237. Message | 0000pnc | Compile Error | / | / | C++14 | 1.5kb | 2024-09-13 20:00:07 | 2024-09-13 20:00:08 |
Judging History
This is the latest submission verdict.
- [2024-09-13 20:00:08]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-09-13 20:00:07]
- Submitted
answer
#include <bits/stdc++.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>(16, 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];
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[i][j]) { d[i] = j + 1; break; }
}
d[i] = min(d[i], 31);
to[i] = (i + d[i]) % 31;
}
vector<bool> vis(31, false);
for (int i = 0; i < 31; i++) {
int cnt = 1, res = to[i];
while (res != i) res = to[res], cnt++;
if (cnt == 16) {
res = to[i]; vis[i] = true;
while (!vis[res]) vis[res] = 1, res = to[res];
}
}
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;
}
詳細信息
answer.code: In function ‘void send_message(std::vector<bool>, std::vector<bool>)’: answer.code:28:40: error: ‘send_packet’ was not declared in this scope 28 | vector<bool> useless = send_packet(all[i]); | ^~~~~~~~~~~ stub.cpp: In function ‘int {anonymous}::sz(const C&)’: stub.cpp:27:52: error: ‘size’ is not a member of ‘std’; did you mean ‘size_t’? 27 | template<class C> int sz(const C& c) { return std::size(c); } | ^~~~ | size_t stub.cpp: In function ‘void {anonymous}::write_int_array(const int*, int)’: stub.cpp:70:13: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ 70 | if (int ret = fwrite(arr, sizeof(int), len, fout); len != ret) { | ^~~ stub.cpp: In function ‘void {anonymous}::read_int_array(int*, int)’: stub.cpp:105:13: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ 105 | if (int ret = fread(arr, sizeof(int), len, fin); len != ret) { | ^~~