Submission #42850

# Submission time Handle Problem Language Result Execution time Memory
42850 2018-03-05T04:53:20 Z kinssang cmp (balkan11_cmp) C++14
46 / 100
2045 ms 104984 KB
#include "cmp.h"

void remember(int n)
{
	n += 4096;

	while (n > 1)
	{
		bit_set(n);
		n >>= 1;
	}
}

int compare(int b)
{
	b += 4096;

	int low = 0, high = 12;

	while (low <= high)
	{
		int mid = (low + high) / 2;

		if (mid == 12)
		{
			high = mid - 1;
			continue;
		}

		int temp = bit_get(b >> mid);

		if (temp == 1) high = mid - 1;
		else low = mid + 1;
	}

	if (high + 1 == 0) return 0;
	if (b >> high == ((b >> (high+1)) * 2)) return -1;
	else return 1;
}
# Verdict Execution time Memory Grader output
1 Partially correct 2045 ms 104984 KB Output is partially correct - maxAccess = 16, score = 46