QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#575094 | #9237. Message | maxrgby | 0 | 1ms | 4140kb | C++20 | 1.8kb | 2024-09-19 10:29:01 | 2024-09-19 10:29:01 |
Judging History
answer
#include "message.h"
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = array<lint, 2>;
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define cr(v, n) (v).clear(), (v).resize(n);
const int MAXN = 200005;
void send_message(vector<bool> M, vector<bool> C) {
vector<int> h(sz(C));
for (int i = 0; i < sz(C); i++) {
if (C[i] == 0) {
for (int j = 1; j < 31; j++) {
if (C[(i + j) % 31] == 0) {
h[i] = j;
break;
}
}
}
}
int z = M.back() ^ 1;
while (sz(M) < 1025)
M.push_back(z);
vector<vector<bool>> R(66, vector<bool>(31));
int p = 0;
for (int i = 0; i < sz(C); i++) {
if (C[i] == 1)
continue;
R[h[i] - 1][i] = 1;
for (int j = h[i]; j < 66; j++) {
R[j][i] = M[p++];
}
}
for(auto i : R){
for(auto j : i){
cout << j;
}
cout << endl;
}
assert(p == 1025);
for (auto &v : R)
send_packet(v);
}
std::vector<bool> receive_message(std::vector<std::vector<bool>> R) {
vector<int> nxt(31), goodRow(31);
for (int i = 0; i < 31; i++) {
int j = 0;
while (j < sz(R) && R[j][i] == 0)
j++;
j++;
nxt[i] = (i + j) % 31;
}
for (int i = 0; i < 31; i++) {
int p = i;
for (int j = 0; j < 16; j++) {
p = nxt[p];
if (j < 15 && p == i) {
p = -1;
break;
}
}
if (p == i) {
for (int j = 0; j < 16; j++) {
goodRow[p] = 1;
p = nxt[p];
}
break;
}
}
assert(count(all(goodRow), 1) == 16);
vector<bool> ans;
for (int i = 0; i < sz(goodRow); i++) {
if (goodRow[i] == 0)
continue;
int h = (nxt[i] - i + 31) % 31;
for (int j = h; j < 66; j++) {
ans.push_back(R[j][i]);
}
}
assert(sz(ans) == 1025);
int z = ans.back();
while (ans.back() == z)
ans.pop_back();
return ans;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3832kb
Manager to Aisha
Aisha to Manager
0000000000100100001111000000010 0000101010110100001111000000011 0100001010110100001111100000011 0000101010110110001111100100011 0000101010110110001111100100011 0100101010110110001111100100011 0100101010110110001111100100011 0000101010110110001111100100011 0000101010110110001111100100011 000010101011...
Manager to Basma
Basma to Manager
Manager to Checker
0 ing with message 'Possible tampering with sol2mgr[0]' Sending secret with code DIE to mgr2sol[0] Sending secret with code DIE to mgr2sol[1] Quitting with result code 11
result:
wrong output format Extra information in the output file
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 1ms
memory: 4140kb
Manager to Aisha
Aisha to Manager
0100111000000110000000100000000 0110010100000111010000110000000 0110011100000100010100110000010 0010000001000001010100100100010 0100100000000100000100110100000 0000110000000111010100010100000 0110001100000001010100010100000 0110101000000000000000010100000 0000101001000100010100010100000 000010010000...
Manager to Basma
Basma to Manager
Manager to Checker
0 ing with message 'Possible tampering with sol2mgr[0]' Sending secret with code DIE to mgr2sol[0] Sending secret with code DIE to mgr2sol[1] Quitting with result code 11
result:
wrong output format Extra information in the output file