제출 #1123679

#제출 시각아이디문제언어결과실행 시간메모리
1123679math_rabbit_1028메시지 (IOI24_message)C++20
30.33 / 100
847 ms832 KiB
#include "message.h" using namespace std; vector<bool> add_blank(vector<bool> A, vector<bool> C) { vector<bool> ret; reverse(A.begin(), A.end()); for (int i = 0; i < 31; i++) { if (C[i]) ret.push_back(0); else { ret.push_back(A.back()); A.pop_back(); } } return ret; } void send_message(vector<bool> M, vector<bool> C) { int S = (int)(M.size()); vector<bool> T(31, 1), F(31, 0); for (int i = 0; i < 30; i++) { if (C[i]) send_packet(T); else send_packet(F); } for (int i = 0; i < S; i += 16) { vector<bool> A(16, 0); for (int j = 0; j < 16; j++) { A[j] = (i+j < S) ? M[i+j] : 0; } send_packet(add_blank(A, C)); } vector<bool> A(16, 0); for (int j = 0; j < 16; j++) { if (j < (S+15)%16+1) A[j] = 1; else A[j] = 0; } send_packet(add_blank(A, C)); } vector<bool> rem_blank(vector<bool> A, vector<bool> C) { vector<bool> ret; for (int i = 0; i < 31; i++) { if (C[i]) continue; else { ret.push_back(A[i]); } } return ret; } vector<bool> receive_message(vector<vector<bool>> R) { vector<bool> C(31, 0); for (int i = 0; i < 30; i++) { vector<bool> V = R[i]; int a = 0, b = 0; // 0 - 1 for (int i = 0; i < 31; i++) { if (V[i]) b++; else a++; } if (a > b) C[i] = 0; else C[i] = 1; } int a = 0, b = 0; // 0 - 1 for (int i = 0; i < 30; i++) { if (C[i]) b++; else a++; } if (a < 16) C[30] = 0; else C[30] = 1; vector<bool> ret; for (int i = 30; i < R.size()-1; i++) { vector<bool> V = rem_blank(R[i], C); for (int j = 0; j < 16; j++) ret.push_back(V[j]); } vector<bool> V = rem_blank(R.back(), C); for (int i = 0; i < 16; i++) { if (!V[i]) ret.pop_back(); } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...