QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#885227#9237. MessageGeekmen0 200ms3840kbC++171.1kb2025-02-06 14:48:232025-02-06 14:48:23

Judging History

This is the latest submission verdict.

  • [2025-02-06 14:48:23]
  • Judged
  • Verdict: 0
  • Time: 200ms
  • Memory: 3840kb
  • [2025-02-06 14:48:23]
  • Submitted

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;
}

詳細信息

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