Submission #1104323

#TimeUsernameProblemLanguageResultExecution timeMemory
1104323tamir1Message (IOI24_message)C++17
0 / 100
1138 ms656 KiB
#include "message.h" #include <bits/stdc++.h> using namespace std; void send_message(vector<bool> M,vector<bool> C) { vector<vector<bool>> A(66, vector<bool> (31,0)); int x=1-M.back(),idx=0; while(M.size()<=1024) M.push_back(x); for(int i=0;i<31;i++){ if(!C[i]){ int j=(i+1)%31,ix=0; while(C[j]){ ix++; j=(j+1)%31; } A[ix][i]=1; for(int j=ix+1;j<66;j++){ A[j][i]=M[idx]; idx++; } } } for(int i=0;i<66;i++) send_packet(A[i]); } vector<bool> receive_message(vector<vector<bool>> R) { vector<int> nxt(31,0); vector<bool> ans={}; for(int i=0;i<31;i++){ nxt[i]=(i+1)%31; for(int j=0;j<66;j++){ if(!R[j][i]) nxt[i]=(nxt[i]+1)%31; else break; } } for(int i=0;i<31;i++){ int x=i; for(int j=0;j<16;j++){ x=nxt[x]; } if(x==i){ for(int j=(nxt[i]-i+31)%31;j<66;j++){ ans.push_back(R[j][i]); } } } int x=ans.back(); while(ans.back()==x) ans.pop_back(); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...