Submission #503449

# Submission time Handle Problem Language Result Execution time Memory
503449 2022-01-08T03:09:14 Z bang627 cmp (balkan11_cmp) C++14
91 / 100
1273 ms 82496 KB
#include "cmp.h"
#include <iostream>

using namespace std;

void remember(int a) {
	int cnt2 = 4;
	while (cnt2 > 0) {
		bit_set(1+ (cnt2 - 1) * 8 +a % 8);
		a >>= 3 , cnt2--;
	}
}

int compare(int b) {
	for (int i = 1; i <= 4; i++) {
		int i2 = 12-3 * i;
		int val = (b >> i2) % 8;
		int readed = bit_get(1 + (i - 1) * 8 + val);
		if (readed == 0) {
			if (val < 4) {
				for (int j = 0; j < val; j++) if (bit_get(1 + (i - 1) * 8 + j) == 1) return 1;
				return -1;
			}
			else {
				for (int j = 7; j > val; j--) if (bit_get(1 + (i - 1) * 8 + j) == 1) return -1;
				return 1;
			}
		}
	}
	return 0;
}

# Verdict Execution time Memory Grader output
1 Partially correct 1273 ms 82496 KB Output is partially correct - maxAccess = 11, score = 91