Submission #1104329

#TimeUsernameProblemLanguageResultExecution timeMemory
1104329tamir1Message (IOI24_message)C++17
100 / 100
1302 ms1096 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={}; bitset<31> ok; 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; bool unen=1; ok.reset(); ok[x]=1; for(int j=0;j<15;j++){ x=nxt[x]; if(ok[x]){ unen=0; break; } ok[x]=1; } if(nxt[x]==i && unen){ 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...