Submission #1221526

#TimeUsernameProblemLanguageResultExecution timeMemory
1221526nibertMessage (IOI24_message)C++17
Compilation error
0 ms0 KiB
#include <vector>
#include <cstdint> // Needed for uint32_t
using namespace std;

// Generator matrix for a (31,16) linear block code
const uint32_t GEN[16] = {
    0b1111111111111110000000000000000,
    0b0111111111111111000000000000000,
    0b0011111111111111100000000000000,
    0b0001111111111111110000000000000,
    0b0000111111111111111000000000000,
    0b0000011111111111111100000000000,
    0b0000001111111111111110000000000,
    0b0000000111111111111111000000000,
    0b0000000011111111111111100000000,
    0b0000000001111111111111110000000,
    0b0000000000111111111111111000000,
    0b0000000000011111111111111100000,
    0b0000000000001111111111111110000,
    0b0000000000000111111111111111000,
    0b0000000000000011111111111111100,
    0b0000000000000001111111111111110,
};

// Provided by grader
extern vector<bool> send_packet(vector<bool> packet);
extern vector<vector<bool>> receive_packets();

void send_message(vector<bool> M, vector<bool>) {
    int L = M.size();
    for (int i = 0; i < L; i += 16) {
        uint32_t word = 0;
        for (int j = 0; j < 16 && i + j < L; ++j)
            if (M[i + j])
                word |= (1u << j);

        vector<bool> packet(31);
        for (int i = 0; i < 31; ++i) {
            int bit = 0;
            for (int j = 0; j < 16; ++j)

Compilation message (stderr)

message.cpp: In function 'void send_message(std::vector<bool>, std::vector<bool>)':
message.cpp:40:41: error: expected statement at end of input
   40 |             for (int j = 0; j < 16; ++j)
      |                                         ^
message.cpp:40:41: error: expected '}' at end of input
message.cpp:38:38: note: to match this '{'
   38 |         for (int i = 0; i < 31; ++i) {
      |                                      ^
message.cpp:40:41: error: expected '}' at end of input
   40 |             for (int j = 0; j < 16; ++j)
      |                                         ^
message.cpp:31:37: note: to match this '{'
   31 |     for (int i = 0; i < L; i += 16) {
      |                                     ^
message.cpp:40:41: error: expected '}' at end of input
   40 |             for (int j = 0; j < 16; ++j)
      |                                         ^
message.cpp:29:49: note: to match this '{'
   29 | void send_message(vector<bool> M, vector<bool>) {
      |                                                 ^