Submission #42273

# Submission time Handle Problem Language Result Execution time Memory
42273 2018-02-24T22:45:58 Z ljk0411jg cmp (balkan11_cmp) C++14
10 / 100
3261 ms 94780 KB
#include "cmp.h"

void remember(int n) {
	int num = n, temp = 0;
	for (int i = 0; i < 12; i++)
	{
		if ((num & (1 << i)) != 0)
		{
			if (i > 5)
			{
				temp |= (1 << i);
			}
			bit_set(i + 1);
		}
	}
	temp++;
	bit_set(temp + 5000);
}

int compare(int b) {
	int temp = 0;
	for (int i = 11; i >= 6; i--)
	{
		if ((b & (1 << i)) != 0)
		{
			temp |= (1 << i);
		}
	}
	temp++;
	if (bit_get(temp + 5000) == 1)
	{
		for (int i = 6; i >= 1; i--)
		{
			int bt = b & (1 << (i - 1));
			if (bit_get(i) == 1)
			{
				if (bt == 0)
				{
					return -1;
				}
			}
			else
			{
				if (bt != 0)
				{
					return 1;
				}
			}
		}
	}
	else
	{
		for (int i = 12; i >= 7; i--)
		{
			int bt = b & (1 << (i - 1));
			if (bit_get(i) == 1)
			{
				if (bt == 0)
				{
					return -1;
				}
			}
			else
			{
				if (bt != 0)
				{
					return 1;
				}
			}
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Partially correct 3261 ms 94780 KB Output is partially correct - maxAccess = 20, score = 10