Submission #552848

# Submission time Handle Problem Language Result Execution time Memory
552848 2022-04-24T07:14:04 Z Aldas25 Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
0 / 100
3046 ms 24220 KB
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)

int firstBit (int x, int y) {
    FOR(i, 0, 15)
        if ((x&(1<<i)) != (y&(1<<i)))
            return i;

    return -1;
}

int encode (int n, int x, int y) {
  int b = firstBit(x, y);
       // if (b == -1) exit(1);
        b++;

        int code = b<<1;
        if (x & (1<<(b-1))) code++;

    return code;
}
	
int decode (int n, int q, int h) {
	bool one = false;
        if (h&1) one = true;
        h >>= 1;
        h--;
        bool has = false;
        if (q & (1<<h)) has = true;

        if (has==one) return 1;
        else return 0;
}
# Verdict Execution time Memory Grader output
1 Partially correct 2960 ms 24220 KB Output is partially correct - maxh = 21
2 Partially correct 3046 ms 24096 KB Output is partially correct - maxh = 21