Submission #57720

# Submission time Handle Problem Language Result Execution time Memory
57720 2018-07-15T22:11:57 Z SpeedOfMagic cmp (balkan11_cmp) C++17
19 / 100
3140 ms 82552 KB
#include "cmp.h"
#include <bits/stdc++.h>
using namespace std;

void remember(int a) {
	int oneAmount = 0;
	for (int i = 0; i < 12; i++)
		if (a & (1 << i))
			oneAmount++;
	
	if (oneAmount > 6) {
		bit_set(13);
		a ^= (1 << 12) - 1;
	}
	
	for (int i = 0; i < 12; i++)
		if ((1 << i) & a)
			bit_set(i + 1);
}

int compare(int b) {
	int d = bit_get(13);
	
	int a = 0;
	
	for (int i = 0; i < 12; i++) {
		int p = bit_get(i + 1);
		a += (1 << i) * p;
	}
	
	if (d)
		a ^= (1 << 12) - 1;
	
	if (a > b)
		return -1;
	else if (a < b)
		return 1;
	else
		return 0;
	
	if ((a < b && !d) || (a > b && d))
		return 1;
	else
		return -1;
}

//‭111101000010‬
//‭110101011111‬
# Verdict Execution time Memory Grader output
1 Partially correct 3140 ms 82552 KB Output is partially correct - maxAccess = 19, score = 19