Submission #39773

# Submission time Handle Problem Language Result Execution time Memory
39773 2018-01-18T12:43:11 Z krauch cmp (balkan11_cmp) C++14
0 / 100
968 ms 82476 KB
#include "cmp.h"

#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)

bool bit(int mask, int i) {
    return (mask >> i) & 1;
}

void remember(int n) {
    int cnt = __builtin_popcount(n);
    if (cnt > 6) {
        bit_set(13);
        n ^= (1 << 12) - 1;
    }
    forn(i, 0, 11) {
        if (bit(n, i)) bit_set(i + 1);
    }
}

int compare(int b) {
    int q = 1;
    if (bit_get(13)) {
        q *= -1;
        b ^= (1 << 12) - 1;
    }
    forn(i, 0, 11) {
        bool x = bit_get(i + 1);
        if (x == bit(b, i)) continue;
        if (x > bit(b, i)) return -q;
        else return q;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 968 ms 82476 KB ZERO POINTS: For a=479 and b=1004, correct answer is 1, got -1