Submission #41534

# Submission time Handle Problem Language Result Execution time Memory
41534 2018-02-18T13:32:57 Z ljk0411jg cmp (balkan11_cmp) C++14
0 / 100
969 ms 82552 KB
#include "cmp.h"
 
void remember(int n) {
	int num = n;
	for (int i = 0; i < 13; i++)
	{
		if ((num & (1 << i)) != 0)
		{
			bit_set(i + 1);
		}
	}
}
 
int compare(int b) {
	int a;
	for (int i = 1; i < 14; i++)
	{
		if (bit_get(i) == 1)
		{
			a = a | (1 << (i - 1));
		}
	}
	if (a > b)
	{
		return -1;
	}
	else if (a == b)
	{
		return 0;
	}
	else
	{
		return 1;
	}
}

Compilation message

cmp.cpp: In function 'int compare(int)':
cmp.cpp:20:6: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
    a = a | (1 << (i - 1));
    ~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 969 ms 82552 KB ZERO POINTS: For a=2048 and b=2053, correct answer is 1, got -1