Submission #381024

# Submission time Handle Problem Language Result Execution time Memory
381024 2021-03-24T08:21:32 Z wp1270 cmp (balkan11_cmp) C
100 / 100
2057 ms 82604 KB
#include "cmp.h"

int base_num[4] = { 480, 48, 6, 1 };
int base_bas[4] = { 12,10,8,6 };
int base_idx[4] = { 1,13,23,31 };

void remember(int n) {
    for (int i = 0; i < 4; i++) {
        bit_set(base_idx[i] + n / base_num[i]);
        n = n % base_num[i];
    }
}

int compare(int b) {
    for (int i = 0; i < 4; i++) {
        int bb = b / base_num[i];
        b %= base_num[i];
        if (bit_get(base_idx[i] + bb)) continue;
        else if (bb < base_bas[i] / 2) {
            for (int j = bb - 1; j >= 0; j--) {
                if (bit_get(base_idx[i] + j)) return 1;
            }
            return -1;
        }
        else {
            for (int j = bb + 1; j < base_bas[i]; j++) {
                if (bit_get(base_idx[i] + j)) return -1;
            }
            return 1;
        }
    }
    return 0;
}

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