Submission #41532

# Submission time Handle Problem Language Result Execution time Memory
41532 2018-02-18T13:20:53 Z pica4500 cmp (balkan11_cmp) C++
10 / 100
2009 ms 98856 KB
#include "cmp.h"

//9점 비벼욧---!!!
void remember(int n) {
	for (int i = 1; i <= 12; i++) {
		if (n & (1 << (i - 1))) bit_set(10000 + i);
	}

	int up = (n >> 6) + 1;
	bit_set(5000 + up);
}

int compare(int b) {
	int up = (b >> 6) + 1;
	int down = (b % (1 << 6)) + 1;

	if (bit_get(5000 + up)) {
		for (int i = 6; i >= 1; i--) {
			bool cur = bit_get(10000 + i);
			bool isExist = b & (1 << (i - 1));
			if (cur && !isExist) return -1;
			if (isExist && !cur) return 1;
		}
		return 0;
	}
	else {
		for (int i = 12; i >= 7; i--) {
			bool cur = bit_get(10000 + i);
			bool isExist = b & (1 << (i - 1));
			if (cur && !isExist) return -1;
			if (isExist && !cur) return 1;
		}
		return 0;
	}
	return 0;
}

Compilation message

cmp.cpp: In function 'int compare(int)':
cmp.cpp:15:6: warning: unused variable 'down' [-Wunused-variable]
  int down = (b % (1 << 6)) + 1;
      ^~~~
# Verdict Execution time Memory Grader output
1 Partially correct 2009 ms 98856 KB Output is partially correct - maxAccess = 20, score = 10