Submission #41533

# Submission time Handle Problem Language Result Execution time Memory
41533 2018-02-18T13:31:29 Z ljk0411jg cmp (balkan11_cmp) C++14
0 / 100
2041 ms 82484 KB
#include "cmp.h"

void remember(int n) {
	int num = n, count = 0;
	for (int i = 0; i < 13; i++)
	{
		if ((num & (1 << i)) != 0)
		{
			bit_set(i + 1);
			count++;
		}
	}
}

int compare(int b) {
	int a = 0;
	for (int i = 13; i >= 1; i--)
	{
		if (bit_get(i) == 1)
		{
			a = a | (1 << (i - 1));
			if (a > b)
			{
				break;
			}
		}
		else
		{
			if ((b & (1 << (i - 1))) != 0)
			{
				break;
			}
		}
	}
	if (a > b)
	{
		return -1;
	}
	else if (a == b)
	{
		return 0;
	}
	else
	{
		return 1;
	}
}

# Verdict Execution time Memory Grader output
1 Incorrect 2041 ms 82484 KB ZERO POINTS: more than 20 accesses in the worst case