Submission #41524

# Submission time Handle Problem Language Result Execution time Memory
41524 2018-02-18T10:37:56 Z pica4500 cmp (balkan11_cmp) C++
0 / 100
1004 ms 90768 KB
#include "cmp.h"
#include <algorithm>
using namespace std;
void remember(int n) {
	int grp = n / 64;
	grp++;

	bit_set(grp);
	bit_set(65 + n);
}

int compare(int b) {

	int bGrp = b / 64;
	bGrp++;

	int aGrp = 0;

	int cnt = 0;
	for (int i = 1; i <= 64; i++) {
		cnt++;
		if (i > bGrp) return -1;
		if (bit_get(i)) {
			aGrp = i;
			break;
		}
		if (cnt == 19) return -1;
	}

	if (aGrp < bGrp) return 1;

	int startG = (aGrp * 64) + 1;
	int endG = startG + 63;

	int a = -1;
	b += 65;
	for (int i = startG; i <= endG; i++) {
		cnt++;
		if (i > b) return -1;
		if (bit_get(i)) {
			a = i;
			break;
		}
		if (cnt == 19) return -1;
	}

	if (a == b) return 0;
	return 1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1004 ms 90768 KB ZERO POINTS: For a=3040 and b=3318, correct answer is 1, got -1