QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#575094#9237. Messagemaxrgby0 1ms4140kbC++201.8kb2024-09-19 10:29:012024-09-19 10:29:01

Judging History

This is the latest submission verdict.

  • [2024-09-19 10:29:01]
  • Judged
  • Verdict: 0
  • Time: 1ms
  • Memory: 4140kb
  • [2024-09-19 10:29:01]
  • Submitted

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