QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#885227 | #9237. Message | Geekmen | 0 | 200ms | 3840kb | C++17 | 1.1kb | 2025-02-06 14:48:23 | 2025-02-06 14:48:23 |
Judging History
answer
#include <iostream>
#include <vector>
#include "message.h"
using namespace std;
void send_message(std::vector<bool> M, std::vector<bool> C) {
int S = M.size();
std::vector<int> pos;
for (int i = 0; i < 30; i ++) {
send_packet(vector<bool>(31, C[i]));
if (!C[i]) pos.push_back(i);
}
std::vector<bool> len(31);
for (int i = 0; i < 16; i ++)
len[pos[i]] = S >> i & 1;
send_packet(len);
for (int i = 0; i < S; i += 16) {
std::vector<bool> tmp(31);
for (int j = i; j < min(i + 16, S); j ++)
tmp[pos[j - i]] = M[j];
send_packet(tmp);
}
}
std::vector<bool> receive_message(std::vector<vector<bool>> R) {
std::vector<int> pos;
int sum = 0;
for (int i = 0; i < 30; i ++) {
int C[2] = {0};
for (int j = 0; j < 31; j ++)
C[R[i][j]] ++;
if (C[0] > C[1]) pos.push_back(i);
sum += C[1] > C[0];
}
if (sum == 15) pos.push_back(30);
int S = 0;
for (int i = 0; i < 16; i ++)
S |= (R[30][pos[i]] << i);
std::vector<bool> res;
for (int i = 31; i < R.size(); i ++)
for (auto j : pos)
res.push_back(R[i][j]);
while (res.size() > S) res.pop_back();
return res;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 99ms
memory: 3840kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
0 ing with message 'decoded message is incorrect' Sending secret with code DIE to mgr2sol[1] Quitting with result code 1
result:
wrong output format Extra information in the output file
Subtask #2:
score: 0
Wrong Answer
Test #8:
score: 0
Wrong Answer
time: 200ms
memory: 3840kb
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
0 ing with message 'decoded message is incorrect' Sending secret with code DIE to mgr2sol[1] Quitting with result code 1
result:
wrong output format Extra information in the output file