Submission #349080

# Submission time Handle Problem Language Result Execution time Memory
349080 2021-01-16T15:11:19 Z cheissmart cmp (balkan11_cmp) C++14
100 / 100
2274 ms 96120 KB
#include "cmp.h"

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

void remember(int n) {
	for(int i = 0; i < 6; i++)
		bit_set((n >> (i * 2)) + add[i]);
}

int compare(int b) {
	int l = 0, r = 5;
	while(l <= r) {
		int m = (l + r) / 2;
		if(bit_get((b >> (m * 2)) + add[m])) r = m - 1;
		else l = m + 1;
	}
	if(l == 0) return 0;
	l--;
	int bit = b >> (l * 2) & 3;
	if(bit < 2) {
		if(bit_get((b >> (l * 2 + 2) << 2) + 0 + add[l])) return 1;
		else return -1;
	} else {
		if(bit_get((b >> (l * 2 + 2) << 2) + 3 + add[l])) return -1;
		else return 1;
	}
}

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