QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#575142#9237. Messagemaxrgby0 1ms4132kbC++202.8kb2024-09-19 10:52:172024-09-19 10:52:17

Judging History

你现在查看的是最新测评结果

  • [2024-09-19 10:52:17]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:4132kb
  • [2024-09-19 10:52:17]
  • 提交

answer

// Source: https://kill.yourself/time/right-now

#include <bits/stdc++.h>
#include "message.h"
using namespace std;

// vector<vector<bool>> hehe;

// void send_message(vector<bool> m, vector<bool> c){
// 	vector<bool> zero (31,0);
// 	vector<bool> one (31,1);
// 	for(auto i : m){
// 		if(i){
// 			send_packet(one);
// 		}else{
// 			send_packet(zero);
// 		}
// 	}
// }

// vector<bool> receive_message(vector<vector<bool>> r){
// 	vector<bool> ans;
// 	for(auto i : r){
// 		int zero = 0;
// 		int one = 0;
// 		for(auto j : i){
// 			if(j){
// 				one++;
// 			}else{
// 				zero++;
// 			}
// 		}
// 		if(zero > one){
// 			ans.push_back(0);
// 		}else{
// 			ans.push_back(1);
// 		}
// 	}
// 	return ans;
// }

// vector<bool> send_packet(vector<bool> e){
// 	for(int i = 2;i < 17;i += 1){
// 		e[i] = !e[i];
// 	}
// 	hehe.push_back(e);
// 	return e;
// }

void send_message(vector<bool> m, vector<bool> c){
	int nxt[31];
	int diff = 0;
	for(int i = 0;i < 31;i++){
		nxt[i] = 66;
		if(c[i]){
			continue;
		}
		for(int j = 1;j < 31;j++){
			if(!c[(i+j)%31]){
				nxt[i] = j;
				diff += j;
				break;
			}
		}
	}
	bool tmp = !m.back();
	while(m.size() < 1025){
		m.push_back(tmp);
	}
	vector<bool> ret[66];
	for(int i = 0;i < 66;i++){
		ret[i].resize(31);
	}
	int pos = 0;
	for(int i = 0;i < 31;i++){
		for(int j = 0;j < nxt[i]-1;j++){
			ret[j][i] = 0;
		}
		ret[nxt[i]-1][i] = 1;
		for(int j = nxt[i];j < 66;j++){
			ret[j][i] = m[pos++];
		}
	}
	for(int i = 0;i < 66;i++){
		for(int j = 0;j < 31;j++){
			cout << ret[i][j];
		}
		cout << endl;
	}
	for(int i = 0;i < 66;i++){
		vector<bool> tmp = send_packet(ret[i]);
		for(int j = 0;j < 31;j++){
			if(tmp[j] != ret[i][j] && !c[j]){
				assert(false);
			}
		}
	}
}

vector<bool> receive_message(vector<vector<bool>> r){
	int nxt[31];
	for(int i = 0;i < 31;i++){
		nxt[i] = 66;
		for(int j = 0;j < 66;j++){
			if(r[j][i]){
				nxt[i] = (i+j+1)%31;
				break;
			}
		}
	}
	int good = -1;
	for(int i = 0;i < 31;i++){
		int u = i;
		for(int j = 0;j < 16;j++){
			u = nxt[u];
		}
		if(u == i){
			good = i;
			break;
		}
	}
	vector<bool> ret;
	for(int i = 0;i < 16;i++){
		int j = 0;
		while(j < 66 and !r[j][good]){
			j++;
		}
		j++;
		while(j < 66){
			ret.push_back(r[j][good]);
			j++;
		}
		good = nxt[good];
	}
	char c = ret.back();
	while(!ret.empty() and ret.back() == c){
		ret.pop_back();
	}
	return ret;
}

// int main() {
// 	int n;
// 	cin >> n;
// 	vector<bool> a;
// 	vector<bool> c(31,0);
// 	for(int i = 0;i < n;i++){
// 		char c;
// 		cin >> c;
// 		a.push_back(c-'0');
// 	}
// 	for(int i = 2;i < 17;i += 1){
// 		c[i] = 1;
// 	}
// 	send_message(a,c);
// 	vector<bool> ans = receive_message(hehe);
// 	assert(ans == a);
// 	for(auto i : ans){
// 		cout << i << " ";
// 	}
// }

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 4060kb

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: 4132kb

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