Submission #724208

# Submission time Handle Problem Language Result Execution time Memory
724208 2023-04-14T21:34:41 Z MojoLake cmp (balkan11_cmp) C++17
100 / 100
1387 ms 96036 KB
#include "cmp.h"
#include <bits/stdc++.h>


using namespace std;

int d[6] = {1, 4097, 5121, 5377, 5441, 5457};

void remember(int x){

    for(int i = 0; i < 6; ++i){
        bit_set((x>>(2*i)) + d[i]);
    }
}


int compare(int x){

    int lo = 0, hi = 6;
    while(lo < hi){
        int m = (hi + lo) / 2;
        int p = (x>>(2 * m)) + d[m];
        if(bit_get(p))hi = m;
        else lo = m + 1;
    }
    if(lo == 0){
        return 0;
    }

    int p = x>>(2 * (lo-1));
    int ld = p & 3;

    if(ld == 0)return -1;
    if(ld == 3)return 1;
    if(ld == 1){
        if(bit_get(4 * (x>>(2 * lo)) + d[lo-1]))return 1;
        else return -1;
    }
    if(ld == 2){
        if(bit_get(4 * (x>>(2 * lo)) + 3 + d[lo-1]))return -1;
        else return 1;
    }
    return 0;
}

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