QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#563268#9237. Messageusing233100 ✓212ms4108kbC++202.2kb2024-09-14 08:55:472024-09-14 08:55:48

Judging History

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

  • [2024-09-14 08:55:48]
  • 评测
  • 测评结果:100
  • 用时:212ms
  • 内存:4108kb
  • [2024-09-14 08:55:47]
  • 提交

answer

#include "message.h"
#include<iostream>
std::vector<bool> send_packet(std::vector<bool> A);
void send_message(std::vector<bool> M,std::vector<bool> C){
	M.push_back(true);
	int lm=M.size(),lnow=0;
	#define Mnex (lnow==lm?false:M[lnow++])
	std::vector<int> las(1,0),lat;
	std::vector<bool> tmp(31,false),res,use;
	for(int i=1;i<=30;i++){
		use.clear();use.resize(31,true);
		for(int j:las)
			use[j]=false;
		for(int j=0;j<31;j++)
			if(!C[j])
				if(!use[j])tmp[j]=C[i];
				else tmp[j]=Mnex;
		res.clear();res=send_packet(tmp);
		lat.clear();
		for(int j:las)
			if(res[j])
				lat.push_back(j);
		las.swap(lat);las.push_back(i);
	}
	for(int i=0;i<=30;i++){
		use.clear();use.resize(31,true);
		for(int j:las)
			use[j]=false;
		for(int j=0;j<31;j++)
			if(!C[j])
				if(!use[j])tmp[j]=C[i];
				else tmp[j]=Mnex;
		res.clear();res=send_packet(tmp);
		lat.clear();
		for(int j:las)
			if(res[j])
				lat.push_back(j);
		las.swap(lat);
	}
	for(int i=61;i<=65;i++){
		for(int j=0;j<31;j++)
			if(!C[j])tmp[j]=Mnex;
		send_packet(tmp);
	}
	#undef Mnex
}
std::vector<bool> receive_message(std::vector<std::vector<bool>> R){
	std::vector<int> nex(31,-1),las(1,0),lat;
	std::vector<bool> res,mes;mes.clear();
	std::vector<std::vector<bool>> useful(66,std::vector<bool>(31,true));
	for(int i=1;i<=30;i++){
		for(int j:las)
			useful[i-1][j]=false;
		res.clear();res=R[i-1];
		lat.clear();
		for(int j:las)
			if(res[j])
				lat.push_back(j);
			else
				nex[j]=i;
		las.swap(lat);las.push_back(i);
	}
	for(int i=0;i<=30;i++){
		for(int j:las)
			useful[i+30][j]=false;
		res.clear();res=R[i+30];
		lat.clear();
		for(int j:las)
			if(res[j])
				lat.push_back(j);
			else
				nex[j]=i;
		las.swap(lat);
	}
	for(int i=0;i<31;i++){
		res.clear();res.resize(31,false);
		int now=i;
		while(now!=-1&&!res[now]){
			res[now]=true;
			now=nex[now];
		}
		if(now==i){
			int cnt=0;
			for(int j=0;j<31;j++)
				cnt+=res[j];
			if(cnt==16)
				break;
		}
	}
	for(int i=0;i<66;i++)
		for(int j=0;j<31;j++)
			if(useful[i][j]&&res[j])
				mes.push_back(R[i][j]);
	while(!mes.back())mes.pop_back();
	mes.pop_back();
	return mes;
}

详细

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 175ms
memory: 3748kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #2:

score: 10
Accepted
time: 161ms
memory: 3804kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #3:

score: 10
Accepted
time: 177ms
memory: 4032kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #4:

score: 10
Accepted
time: 212ms
memory: 3984kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #5:

score: 10
Accepted
time: 148ms
memory: 3732kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #6:

score: 10
Accepted
time: 75ms
memory: 4032kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #7:

score: 10
Accepted
time: 119ms
memory: 3808kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Subtask #2:

score: 90
Accepted

Test #8:

score: 90
Accepted
time: 147ms
memory: 3824kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #9:

score: 90
Accepted
time: 192ms
memory: 4032kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #10:

score: 90
Accepted
time: 157ms
memory: 4004kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #11:

score: 90
Accepted
time: 211ms
memory: 4108kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #12:

score: 90
Accepted
time: 145ms
memory: 3748kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #13:

score: 90
Accepted
time: 144ms
memory: 4032kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #14:

score: 90
Accepted
time: 93ms
memory: 3768kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #15:

score: 90
Accepted
time: 123ms
memory: 4092kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #16:

score: 90
Accepted
time: 151ms
memory: 3832kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #17:

score: 90
Accepted
time: 185ms
memory: 4092kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #18:

score: 90
Accepted
time: 125ms
memory: 3808kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #19:

score: 90
Accepted
time: 159ms
memory: 3752kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #20:

score: 90
Accepted
time: 204ms
memory: 3828kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #21:

score: 90
Accepted
time: 143ms
memory: 3732kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #22:

score: 90
Accepted
time: 143ms
memory: 4020kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #23:

score: 90
Accepted
time: 158ms
memory: 3768kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #24:

score: 90
Accepted
time: 172ms
memory: 3996kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #25:

score: 90
Accepted
time: 203ms
memory: 3808kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #26:

score: 90
Accepted
time: 161ms
memory: 3812kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Test #27:

score: 90
Accepted
time: 157ms
memory: 3756kb

Manager to Aisha


Aisha to Manager


Manager to Basma


Basma to Manager


Manager to Checker

1

result:

points 1.0

Extra Test:

score: 0
Extra Test Passed