QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#563244 | #9237. Message | using233 | 0 | 0ms | 0kb | C++20 | 2.2kb | 2024-09-14 08:33:18 | 2024-09-14 08:33:19 |
answer
#include<vector>
#include"message.h"
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=62;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: 0
Instance #1 Runtime Error
Test #1:
score: 0
Instance #1 Runtime Error
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
0 ing with message 'manual RTE, cant read int from grader' Quitting with result code 1
result:
Subtask #2:
score: 0
Instance #1 Runtime Error
Test #8:
score: 0
Instance #1 Runtime Error
Manager to Aisha
Aisha to Manager
Manager to Basma
Basma to Manager
Manager to Checker
0 ing with message 'manual RTE, cant read int from grader' Quitting with result code 1