Submission #746584

# Submission time Handle Problem Language Result Execution time Memory
746584 2023-05-22T21:14:01 Z finn__ Question (Grader is different from the original contest) (CEOI14_question_grader) C++17
Compilation error
0 ms 0 KB
struct precalc
{
    int p[924];
    constexpr precalc()
    {
        int l = 0;
        for (int i = 0; i < 1 << 12; ++i)
            if (__builtin_popcount(i) == 6)
                p[l++] = i;
    }
};

constexpr precalc z;

int encode(int n, int x, int y) { return __builtin_ctz(z.p[x] ^ z.p[y]) + 1; }
struct precalc
{
    int p[924];
    constexpr precalc()
    {
        int l = 0;
        for (int i = 0; i < 1 << 12; ++i)
            if (__builtin_popcount(i) == 6)
                p[l++] = i;
    }
};

constexpr precalc z;

int decode(int n, int q, int h) { return z.p[q] & (1 << (h - 1)); }

Compilation message

encoder.cpp: In constructor 'constexpr precalc::precalc()':
encoder.cpp:10:5: error: member 'precalc::p' must be initialized by mem-initializer in 'constexpr' constructor
   10 |     }
      |     ^
encoder.cpp:3:9: note: declared here
    3 |     int p[924];
      |         ^
encoder.cpp: At global scope:
encoder.cpp:13:19: error: 'constexpr precalc::precalc()' called in a constant expression
   13 | constexpr precalc z;
      |                   ^
encoder.cpp:4:15: note: 'constexpr precalc::precalc()' declared here
    4 |     constexpr precalc()
      |               ^~~~~~~

decoder.cpp: In constructor 'constexpr precalc::precalc()':
decoder.cpp:10:5: error: member 'precalc::p' must be initialized by mem-initializer in 'constexpr' constructor
   10 |     }
      |     ^
decoder.cpp:3:9: note: declared here
    3 |     int p[924];
      |         ^
decoder.cpp: At global scope:
decoder.cpp:13:19: error: 'constexpr precalc::precalc()' called in a constant expression
   13 | constexpr precalc z;
      |                   ^
decoder.cpp:4:15: note: 'constexpr precalc::precalc()' declared here
    4 |     constexpr precalc()
      |               ^~~~~~~