Submission #934515

#TimeUsernameProblemLanguageResultExecution timeMemory
934515tmarcinkeviciusParrots (IOI11_parrots)C++14
Compilation error
0 ms0 KiB
#include "encoder.h"
#include "encoderlib.h"

void encode(int N, int M[])
{
    for (int i = 0; i < N; i++)
    {
        bitset<16> number(M[i]);

        bitset<8> position(i);
        for (int i = 0; i < 8; i++)
        {
            number[8 + i] = position[i];
        }
        send((int)number.to_ulong());
    }
}
#include "decoder.h"
#include "decoderlib.h"

void decode(int N, int L, int X[])
{
    vector<int> ans(N);

    for (int i = 0; i < L; i++)
    {
        bitset<16> number(X[i]);
        bitset<8> num, pos;

        for (int i = 0; i < 8; i++)
        {
            pos[i] = number[8 + i];
            num[i] = number[i];
        }
        int position = (int)pos.to_ullong();
        int theNum = (int)num.to_ullong();
        ans[position] = theNum;
    }

    for (int i = 0; i < L; i++)
    {
        output(ans[i]);
    }
}

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:8:9: error: 'bitset' was not declared in this scope
    8 |         bitset<16> number(M[i]);
      |         ^~~~~~
encoder.cpp:8:20: error: 'number' was not declared in this scope
    8 |         bitset<16> number(M[i]);
      |                    ^~~~~~
encoder.cpp:10:19: error: 'position' was not declared in this scope
   10 |         bitset<8> position(i);
      |                   ^~~~~~~~

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:6:5: error: 'vector' was not declared in this scope
    6 |     vector<int> ans(N);
      |     ^~~~~~
decoder.cpp:6:12: error: expected primary-expression before 'int'
    6 |     vector<int> ans(N);
      |            ^~~
decoder.cpp:10:9: error: 'bitset' was not declared in this scope
   10 |         bitset<16> number(X[i]);
      |         ^~~~~~
decoder.cpp:10:20: error: 'number' was not declared in this scope
   10 |         bitset<16> number(X[i]);
      |                    ^~~~~~
decoder.cpp:11:19: error: 'num' was not declared in this scope; did you mean 'enum'?
   11 |         bitset<8> num, pos;
      |                   ^~~
      |                   enum
decoder.cpp:11:24: error: 'pos' was not declared in this scope
   11 |         bitset<8> num, pos;
      |                        ^~~
decoder.cpp:20:9: error: 'ans' was not declared in this scope
   20 |         ans[position] = theNum;
      |         ^~~
decoder.cpp:25:16: error: 'ans' was not declared in this scope
   25 |         output(ans[i]);
      |                ^~~