Submission #447178

# Submission time Handle Problem Language Result Execution time Memory
447178 2021-07-25T02:36:37 Z zaneyu cmp (balkan11_cmp) C++14
100 / 100
2347 ms 102172 KB
#include "cmp.h"
void remember(int n) {
    n+=4096;
    while(n>1) bit_set(n),n/=4;
}
int compare(int b) {
    b+=4096;
    int l=0,r=6;
    bool hv=0;
    int d;
    while(l<=r){
        int mid=(l+r)/2;
        if(!bit_get(b>>(mid*2)) and mid!=6){
            l=mid+1;
            d=(b>>(mid*2));
            hv=1;
        }
        else r=mid-1;
    }
    if(!hv) return 0; 
    if((d%4)>1){
        if(bit_get(d/4*4+3)) return -1;
        return 1;
    }
    else{   
        if(bit_get(d/4*4)) return 1;
        return -1;
    }
}

# Verdict Execution time Memory Grader output
1 Correct 2347 ms 102172 KB Output is correct - maxAccess = 10, score = 100