제출 #1231148

#제출 시각아이디문제언어결과실행 시간메모리
1231148sahasradMessage (IOI24_message)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int mask = 65535; vector<int> seq = {25226, 3520, 25771, 26888, 22115, 61712, 45676, 17833, 47399, 59849, 13569, 14556, 506, 21088, 18877, 48567}; int check = 10; vector<bool> encode(vector<bool> &M, vector<bool> &C) { vector<bool> packet(31); int ptr = 0; for (int j = 0; j < 31; j++) { if (C[j]) continue; packet[j] = M[ptr++]; } return packet; } void send_message(vector<bool> M, vector<bool> C) { if (!M.back()) { for (int i = 0; i < M.size(); i++) { M[i] = !M[i]; } for (int i = 0; i < seq.size(); i++) { seq[i] ^= mask; } } for (int i = 0; i < check; i++) { int val = seq[i]; vector<bool> bits(16); for (int j = 0; j < 16; j++) { bits[j] = val & 1; val >>= 1; } send_packet(encode(bits, C)); } int packets = (M.size() + 15) / 16; for (int i = 0; i < packets; i++) { vector<bool> m(16); for (int j = 0; j < 16; j++) { int idx = i * 15 + j; if (idx >= M.size()) break; m[j] = M[idx]; } send_packet(encode(m, C)); } } vector<int> get_subseq(vector<vector<bool>> R) { vector<int> bits; int tokenPtr = 0; int ptr = 0; while (tokenPtr < 15 && ptr < 31) { bool works = true; for (int i = 0; i < check; i++) { if (R[i][ptr] != (seq[i] & (1 << tokenPtr)) > 0) { works = false; break; } } if (works) { bits.push_back(tokenPtr++); } ptr++; } return bits; } vector<bool> receive_message(vector<vector<bool>> R) { vector<int> bits = get_subseq(R); bool invert = false; if (bits.size() < 15) { invert = true; for (int i = 0; i < seq.size(); i++) { seq[i] ^= mask; } bits = get_subseq(R); } vector<bool> ans; for (int i = check; i < R.size(); i++) { for (int j = 0; j < 16; j++) { ans.push_back(R[i][bits[j]]); } } while (ans.back() == 0) { ans.pop_back(); } if (invert) { for (int i = 0; i < ans.size(); i++) { ans[i] = !ans[i]; } } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

message.cpp: In function 'void send_message(std::vector<bool>, std::vector<bool>)':
message.cpp:36:9: error: 'send_packet' was not declared in this scope
   36 |         send_packet(encode(bits, C));
      |         ^~~~~~~~~~~
message.cpp:47:9: error: 'send_packet' was not declared in this scope
   47 |         send_packet(encode(m, C));
      |         ^~~~~~~~~~~