Submission #964673

# Submission time Handle Problem Language Result Execution time Memory
964673 2024-04-17T10:15:28 Z vjudge1 cmp (balkan11_cmp) C++17
0 / 100
0 ms 2392 KB
#include "cmp.h"


int jmp[9] = {0, 4, 4+16, 4+16+64, 4+16+64+256, 4+16+64+256+1024};

void remember(int n) {
    for(int i=5;i>=0;--i)
        bit_set((n>>2*i)+jmp[i]);
}

int compare(int b) {
    int lower = -1, upper = 6;
    while (upper-lower>1)
    {
        int mid=lower+(upper-lower)/2;
        int div = 5-mid;
        if (bit_get((b>>2*div)+jmp[div])) lower=mid;
        else upper=mid;
    }
    if (lower == 5)
        return 0;
    int P = (b>>2*lower)*4+jmp[lower+1];
    int db = (b>>(2*lower-2))&4;
    if (db == 0)
        return -1;
    if (db == 3)
        return 1;
    if (db == 1)
    {
        if (bit_get(P))
            return 1;
        return -1;
    }

    if (bit_get(P+3))
        return -1;
    return 1;
}

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2392 KB ZERO POINTS: bit_set with addr out of range 0