#include "cmp.h"
void remember (int value) {
int a[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int c = 12, cnt = 0;
while (c--) {
a[c] = value & 1;
if (value & 1) {
++cnt;
}
value >>= 1;
}
if (cnt > 6) {
bit_set(1);
for (c=0; c<12; ++c) {
if (!a[c]) bit_set(c + 2);
}
} else for (c=0; c<12; ++c) {
if (a[c]) bit_set(c + 2);
}
}
int compare (int value) {
int inverse = bit_get(1);
int i, num = 0;
for (i=0; i<12; ++i) {
num <<= 1;
num |= inverse ^ bit_get(i + 2);
}
if (value < num) {
return -1;
} else if (value == num) {
return 0;
}
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2488 ms |
82476 KB |
Output is partially correct - maxAccess = 19, score = 19 |