Submission #1134011

#TimeUsernameProblemLanguageResultExecution timeMemory
1134011NamkhingMessage (IOI24_message)C++20
0 / 100
35 ms836 KiB
#include "message.h" #include <bits/stdc++.h> using namespace std; void send_message(vector<bool> M, vector<bool> C) { vector<bool> A(31); int n = M.size(); int now = 0; for (int j = 0; j < 31 && now < n; j++) { if (!C[j]) { A[j] = 1 - M[now]; now++; } } send_packet(A); now = 0; while (now < n) { for (int j = 0; j < 31; j++) A[j] = 0; for (int j = 0; j < 31 && now < n; j++) { if (C[j] == 0) { A[j] = M[now]; now++; } } send_packet(A); } for (int j = 0; j < 31; j++) A[j] = 0; for (int j = 0; j < 31; j++) { if (!C[j]) { A[j] = n % 2; n /= 2; } } send_packet(A); } vector<bool> receive_message(vector<vector<bool>> R) { vector<bool> C(31); for (int i = 0; i < 31; i++) { if (R[0][i] == R[1][i]) C[i] = 1; } int m = R.size(); int n = 0, now = 0; for (int j = 0; j < 31; j++) { if (!C[j]) { n |= (R[m-1][j] << now); now++; } } vector<bool> ans; now = 0; for (int i = 1; i < m - 1; i++) { for (int j = 0; j < 31; j++) { if (!C[j]) { ans.push_back(R[i][j]); now++; } if (now == n) return ans; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...