QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#554547 | #9237. Message | Eternatis | 0 | 0ms | 0kb | C++17 | 1.8kb | 2024-09-09 11:57:47 | 2024-09-09 11:57:47 |
answer
#include<bits/stdc++.h>
#include "message.h"
using namespace std;
#define pb push_back
//vector<vector<bool>> now;
//void send_packet(vector<bool> v){
// now.pb(v);
//}
void send_message(std::vector<bool> M, std::vector<bool> C){
M.pb(1),M.resize(1025,0);
vector<int> p;
vector<int> d(16);
for(int i=0;i<31;i++)if(!C[i])p.pb(i);
for(int i=0;i<16;i++)d[i]=(p[(i+1)%16]-p[i]+31)%31;
vector<vector<bool>> data(66,vector<bool>(31,0));
int pos=0;
for(int i=0;i<16;i++){
for(int j=0;j<d[i]-1;j++)data[j][p[i]]=0;
data[d[i]-1][p[i]]=1;
for(int j=d[i];j<66;j++)data[j][p[i]]=M[pos++];
}
for(int i=0;i<66;i++)send_packet(data[i]);
}
std::vector<bool> receive_message(std::vector<std::vector<bool>> R){
vector<int> to(31),vis(31,0);
for(int i=0;i<31;i++){
to[i]=i;
for(int j=0;j<66;j++)
if(R[j][i]){
to[i]=(i+j+1)%31;
break;
}
}
vector<int> p,tmp;
for(int i=0;i<31;i++){
if(vis[i])continue;
tmp.clear();
int now=i;
do{tmp.pb(now),now=to[now],vis[now]=1;}while(now!=i);
if(tmp.size()==16){
p=tmp;
break;
}
}
vector<bool> ans;
for(auto x:p)
for(int i=0;i<66;i++)
if(R[i][x]){
for(int j=i+1;j<66;j++)
ans.pb(R[j][x]);
break;
}
while(!ans.back())ans.pop_back();
ans.pop_back();
return ans;
}
//int n;
//int read(){
// int x=0,f=1;
// char ch=getchar();
// while(ch<'0'||ch>'9'){
// if(ch=='-')f=-1;
// ch=getchar();
// }
// while(ch>='0'&&ch<='9'){
// x=(x<<1)+(x<<3)+(ch^48);
// ch=getchar();
// }
// return x*f;
//}
//signed main(){
// n=read();
// vector<bool> a,b,s;
// for(int i=1;i<=n;i++)a.pb(read());
// for(int i=1;i<=31;i++)b.pb(read());
// send_message(a,b);
// s=receive_message(now);
// for(auto x:s)cout << x << " ";
// return 0;
//}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Instance #1 Time Limit Exceeded
Test #1:
score: 0
Instance #1 Time Limit Exceeded
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 Time Limit Exceeded
Test #8:
score: 0
Instance #1 Time Limit Exceeded
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