QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#817060 | #9237. Message | Y_zhao | Compile Error | / | / | C++14 | 2.2kb | 2024-12-16 20:07:05 | 2024-12-16 20:07:05 |
Judging History
This is the latest submission verdict.
- [2024-12-16 20:07:05]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-12-16 20:07:05]
- Submitted
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;
}
詳細信息
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) { | ^~~