제출 #696467

#제출 시각아이디문제언어결과실행 시간메모리
696467pls33앵무새 (IOI11_parrots)C++17
컴파일 에러
0 ms0 KiB
#include "encoder.h"
#include "encoderlib.h"

// miau
const _bit noise("0010110000110010111110010001001011111110010001111110000001100101000100000010010001010110101100011000001101110110001000000001011101101111000111010000100100000000111101110111010100011011010101011011111011000111111000000101000011011011100011010001000101000010");

void encode(int N, int M[])
{
    _bit a, b;

    int set_count = 0;
    _bit *c = &a;
    for (int i = 0; i < N; i++)
    {
        if (set_count == 256)
        {
            c = &b;
            set_count = 0;
        }

        *c |= M[i];

        set_count += 8;
        if (set_count < min(256, 8 * N))
        {
            *c <<= 8;
        }
    }

    for (int i = 0; i < min(256, 8 * N); i++)
    {
        a[i] = a[i] ^ noise[i];
    }
    for (int i = 0; i < 8 * N - 256; i++)
    {
        b[i] = b[i] ^ noise[i];
    }

    for (int i = 0; i < 256; i++)
    {
        int count = a[i] | (b[i] << 1);

        for (int j = 0; j < count; j++)
        {
            send(i);
        }
    }
}
#include "decoder.h"
#include "decoderlib.h"

// uaim
const _bit noise("0010110000110010111110010001001011111110010001111110000001100101000100000010010001010110101100011000001101110110001000000001011101101111000111010000100100000000111101110111010100011011010101011011111011000111111000000101000011011011100011010001000101000010");

void decode(int N, int L, int X[])
{
    bitset<512> a;
    vi16 count(256);

    for (int i = 0; i < L; i++)
    {
        count[X[i]]++;
    }

    for (int i = 0; i < 256; i++)
    {
        a[i] = bool(count[i] & 1) ^ noise[i];
        a[i + 256] = bool(count[i] & 2) ^ noise[i];
    }

    vi32 things_a;
    for (int i = 0; i < N; i++)
    {
        int val = 0;
        for (int j = 0; j < 8; j++)
        {
            val |= a[j] << j;
        }
        things_a.push_back(val);
        a >>= 8;
    }

    for (int i = (int)things_a.size() - 1; i >= 0; i--)
    {
        output(things_a[i]);
    }
}

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

encoder.cpp:5:7: error: '_bit' does not name a type
    5 | const _bit noise("0010110000110010111110010001001011111110010001111110000001100101000100000010010001010110101100011000001101110110001000000001011101101111000111010000100100000000111101110111010100011011010101011011111011000111111000000101000011011011100011010001000101000010");
      |       ^~~~
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:9:5: error: '_bit' was not declared in this scope
    9 |     _bit a, b;
      |     ^~~~
encoder.cpp:12:11: error: 'c' was not declared in this scope
   12 |     _bit *c = &a;
      |           ^
encoder.cpp:12:16: error: 'a' was not declared in this scope
   12 |     _bit *c = &a;
      |                ^
encoder.cpp:17:18: error: 'b' was not declared in this scope
   17 |             c = &b;
      |                  ^
encoder.cpp:24:25: error: 'min' was not declared in this scope
   24 |         if (set_count < min(256, 8 * N))
      |                         ^~~
encoder.cpp:30:25: error: 'min' was not declared in this scope
   30 |     for (int i = 0; i < min(256, 8 * N); i++)
      |                         ^~~
encoder.cpp:32:23: error: 'noise' was not declared in this scope
   32 |         a[i] = a[i] ^ noise[i];
      |                       ^~~~~
encoder.cpp:36:9: error: 'b' was not declared in this scope
   36 |         b[i] = b[i] ^ noise[i];
      |         ^
encoder.cpp:36:23: error: 'noise' was not declared in this scope
   36 |         b[i] = b[i] ^ noise[i];
      |                       ^~~~~
encoder.cpp:41:29: error: 'b' was not declared in this scope
   41 |         int count = a[i] | (b[i] << 1);
      |                             ^

decoder.cpp:5:7: error: '_bit' does not name a type
    5 | const _bit noise("0010110000110010111110010001001011111110010001111110000001100101000100000010010001010110101100011000001101110110001000000001011101101111000111010000100100000000111101110111010100011011010101011011111011000111111000000101000011011011100011010001000101000010");
      |       ^~~~
decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:9:5: error: 'bitset' was not declared in this scope
    9 |     bitset<512> a;
      |     ^~~~~~
decoder.cpp:9:17: error: 'a' was not declared in this scope
    9 |     bitset<512> a;
      |                 ^
decoder.cpp:10:5: error: 'vi16' was not declared in this scope
   10 |     vi16 count(256);
      |     ^~~~
decoder.cpp:14:9: error: 'count' was not declared in this scope
   14 |         count[X[i]]++;
      |         ^~~~~
decoder.cpp:19:21: error: 'count' was not declared in this scope
   19 |         a[i] = bool(count[i] & 1) ^ noise[i];
      |                     ^~~~~
decoder.cpp:19:37: error: 'noise' was not declared in this scope
   19 |         a[i] = bool(count[i] & 1) ^ noise[i];
      |                                     ^~~~~
decoder.cpp:23:5: error: 'vi32' was not declared in this scope
   23 |     vi32 things_a;
      |     ^~~~
decoder.cpp:31:9: error: 'things_a' was not declared in this scope
   31 |         things_a.push_back(val);
      |         ^~~~~~~~
decoder.cpp:35:23: error: 'things_a' was not declared in this scope
   35 |     for (int i = (int)things_a.size() - 1; i >= 0; i--)
      |                       ^~~~~~~~