QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#563246 | #9237. Message | Andy_Lin | Compile Error | / | / | C++14 | 1.4kb | 2024-09-14 08:34:14 | 2024-09-14 08:34:14 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
void send_message(vector<bool>M,vector<bool>C){
int pos=0;
vector<bool>cs;
for(int i=0;i<66;++i){
cs.clear();
for(int j=0;j<31;++j){
if(C[j]||pos>=M.size()){cs.push_back(0);continue;}
int k=0;
for(;k<31;++k){
if(!C[(j+k+1)%31])break;
}
if(i<k)cs.push_back(0);
if(i==k)cs.push_back(1);
cs.push_back(M[pos]);++pos;
}
send_packet(cs);
if(pos>=M.size())return;
}
}
vector<bool>receive_message(vector<vector<bool>>R){
int dep[31],nxt[31];
for(int i=0;i<31;++i)dep[i]=0,nxt[i]=0;
for(int i=0;i<R.size();++i){
for(int j=0;j<R[i].size();++j){
if(nxt[j])continue;
if(R[i][j]==1){
nxt[j]=i+1;
}
}
}
bool tru[31];
for(int i=0;i<31;++i)tru[i]=0;
for(int i=0;i<31;++i){
if(!dep[i]){
int x=i;
bool ok=0;
while(1){
if(dep[x+nxt[x]]){
if(dep[(x+nxt[x])%31]+15==dep[x]){
ok=1;break;
}
}
dep[(x+nxt[x])%31]=dep[x]+1;
x=(x+nxt[x])%31;
}
if(ok){
for(int i=0;i<16;++i){
tru[x]=1;x=(x+nxt[x])%31;
}
}
}
}
vector<bool>cs={};
for(int i=0;i<R.size();++i){
for(int j=0;j<R[i].size();++j){
if(!tru[j])continue;
if(i>=nxt[j])cs.push_back(R[i][j]);
}
}
return cs;
}
详细
answer.code: In function ‘void send_message(std::vector<bool>, std::vector<bool>)’: answer.code:18:5: error: ‘send_packet’ was not declared in this scope 18 | send_packet(cs); | ^~~~~~~~~~~ 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) { | ^~~