QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#563239 | #9237. Message | using233 | Compile Error | / | / | C++14 | 2.1kb | 2024-09-14 08:27:17 | 2024-09-14 08:27:18 |
Judging History
This is the latest submission verdict.
- [2024-09-14 08:27:18]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-09-14 08:27:17]
- Submitted
answer
#include<vector>
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;
}
详细
stub.cpp: In function ‘int {anonymous}::sz(const C&)’: stub.cpp:27:52: error: ‘size’ is not a member of ‘std’; did you mean ‘size_t’? 27 | template<class C> int sz(const C& c) { return std::size(c); } | ^~~~ | size_t stub.cpp: In function ‘void {anonymous}::write_int_array(const int*, int)’: stub.cpp:70:13: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ 70 | if (int ret = fwrite(arr, sizeof(int), len, fout); len != ret) { | ^~~ stub.cpp: In function ‘void {anonymous}::read_int_array(int*, int)’: stub.cpp:105:13: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ 105 | if (int ret = fread(arr, sizeof(int), len, fin); len != ret) { | ^~~