QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#560069#9237. Messagesynonym0 1ms3984kbC++172.3kb2024-09-12 11:58:272024-09-12 11:58:27

Judging History

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

  • [2024-09-12 11:58:27]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3984kb
  • [2024-09-12 11:58:27]
  • 提交

answer

#include "bits/stdc++.h"
#include "message.h"

using namespace std;
#define int long long
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()

const int L = 31;
/*
vector<vector<bool>> kk;

void send_packet(vector<bool> s) {
	kk.push_back(s);
}
*/
void send_message(vector<bool> M, vector<bool> C) {
	vector<int> pos;
	for (int i=0; i<L; i++) {if (!C[i]) pos.push_back(i);}
	vector<int> dist;
	for (int i=0; i<sz(pos); i++) {
		dist.push_back((L+pos[(i+1)%sz(pos)]-pos[i])%L);
		cout<<dist[i]<<" ";
	}
	cout<<endl;
//good bits
	for (int i=0; i<5; i++) {
		vector<bool> msg(L,0);
		for (int j=0; j<sz(pos); j++) {
			msg[pos[j]] = (1<<i)&dist[j];
		}
		send_packet(msg);
	}
//length of message
	int len = sz(M);
	vector<bool> lmsg(L,0);
	for (int i=0; i<sz(pos); i++) {
		lmsg[pos[i]] = (1<<i)&len;
	}
	send_packet(lmsg);
//message
	vector<bool> cmsg(L,0);
	int cp = 0;
	for (int i=0; i<sz(M); i++) {
		if (cp==sz(pos)) {
			send_packet(cmsg);
			cmsg = vector<bool>(L,0);
			cp = 0;
		}
		cmsg[pos[cp++]] = M[i];
	}
	if (cp) {
		send_packet(cmsg);
	}
}

vector<bool> receive_message(vector<vector<bool>> R) {
	vector<int> nxt(L,0);
	int cp = 0;
	for (int i=0; i<5; i++) {
		vector<bool> msg = R[cp++];
		for (int j=0; j<L; j++) {
			nxt[j] += (msg[j] ? 1<<i : 0);
		}
	}
	vector<int> pos;
	for (int i=0; i<L; i++) {
		int cyc = 1;
		int cp = (i+nxt[i])%L;
		while (cp != i) {
			cp = (cp+nxt[cp])%L;
			cyc++;
			if (cyc==100) break;
		}
		if (cyc==16) {
			pos.push_back(i);
		}
	}
	int len=0;
	vector<bool> lmsg = R[cp++];
	for (int i=0; i<sz(pos); i++) {
		if (lmsg[pos[i]]) {
			len += (1<<i);
		}
	}
	cout<<len<<endl;
	vector<bool> fmsg;
	while (cp < sz(R)) {
		vector<bool> pk = R[cp++];
		for (int i : pos) {
			fmsg.push_back(pk[i]);
		}
	}
	fmsg.resize(len);
	return fmsg;
}
/*
signed main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	vector<bool> msg = {{0,0,0,0,1,0,1,0,0,0,0,1,1,1,1,1,1,0}};
	vector<bool> ctrl;
	for (int i=0; i<15; i++) {
		ctrl.push_back(1);
	}
	ctrl.resize(31);
	send_message(msg,ctrl);
	
	for (auto i : kk) {
		for (auto j : i) cout<<j;
		cout<<endl;
	}
	vector<bool> ans = receive_message(kk);
	cout<<"\n\n";
	for (auto i : ans) cout<<i;
	return 0;
}
*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

Manager to Aisha


Aisha to Manager

3 2 2 2 1 2 1 4 1 1 1 1 3 4 1 2 

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

Manager to Aisha


Aisha to Manager

1 2 1 1 1 2 4 1 1 2 2 3 1 2 4 3 

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