Submission #1121054

#TimeUsernameProblemLanguageResultExecution timeMemory
1121054woohyun_jngMessage (IOI24_message)C++17
43.96 / 100
2995 ms1092 KiB
#include "message.h" #include <bits/stdc++.h> using namespace std; void send_message(vector<bool> M, vector<bool> C) { vector<bool> A(31, 0); vector<int> B; int cnt = 0; for (int i = 0; i < 31; i++) { fill(A.begin(), A.end(), !C[i]); send_packet(A), cnt++; if (!C[i]) B.push_back(i); if (B.size() == 5) { for (int j = i + 1; j < 31; j++) { if (!C[j]) { B.push_back(j); continue; } for (int k = 0; k < 5; k++) A[B[k]] = j & (1 << k); send_packet(A), cnt++; } break; } } int S = M.size(); for (int j = 0; j < 10; j++) A[B[j]] = S & (1 << j); send_packet(A); for (int i = 0; 16 * i < S; i++) { for (int j = 0; j < 16 && 16 * i + j < S; j++) A[B[j]] = M[16 * i + j]; send_packet(A); } } vector<bool> receive_message(vector<vector<bool>> R) { vector<bool> res, C(31, 1); vector<int> cor, nt; int cnt = 0, val, S = 0; for (int i = 0; i < (int)R.size(); i++) { cnt = 0; for (bool j : R[i]) cnt += j; if (cnt >= 16) cor.push_back(i); else nt.push_back(i); if (cor.size() == 5) { for (int j = i + 1; j < 20; j++) { val = 0; for (int k = 4; k >= 0; k--) val = (val << 1) | R[j][cor[k]]; nt.push_back(val); } break; } } for (int i : nt) C[i] = 0; cor.clear(); for (int i = 0; i < 31; i++) if (C[i]) cor.push_back(i); for (int i = 9; i >= 0; i--) S = (S << 1) | R[20][cor[i]]; if (S == 0) S = 1024; for (int i = 21; i < (int)R.size(); i++) for (int j = 0; j < 16; j++) if ((i - 21) * 16 + j < S) res.push_back(R[i][cor[j]]); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...