Submission #132818

#TimeUsernameProblemLanguageResultExecution timeMemory
132818Osama_AlkhodairyQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++17
Compilation error
0 ms0 KiB
int encode (int n, int x, int y) {
    int h = 0;
    while(((x >> h) & 1) == ((y >> h) & 1)) h++;
    assert(h < 10);
    if((x >> h) & 1) h += 10;
    return h;
}
int decode (int n, int q, int h) {
    int xbit = h >= 10;
    if(h >= 10) h -= 10;
    if(((q >> h) & 1) == xbit) return 1;
    return 0;
}

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:4:5: error: 'assert' was not declared in this scope
     assert(h < 10);
     ^~~~~~
encoder.cpp:4:5: note: suggested alternative: 'short'
     assert(h < 10);
     ^~~~~~
     short