#include "cmp.h"
const int BLOCK = (1 << 3);
const int SIZE = 12;
void remember(int n) {
for (int i = SIZE - 3, pos = 1; i >= 0; i -= 3, pos += BLOCK) {
int cur = (n >> i) & (BLOCK - 1);
bit_set(pos + cur);
}
}
int compare(int b) {
for (int i = SIZE - 3, pos = 1; i >= 0; i -= 3, pos += BLOCK) {
int cur = (b >> i) & (BLOCK - 1);
if (!bit_get(pos + cur)) {
if (cur <= 3) {
for (int j = 0; j < cur; j++) {
if (bit_get(pos + j))
return 1;
}
return -1;
} else {
for (int j = cur + 1; j < 8; j++) {
if (bit_get(pos + j))
return -1;
}
return 1;
}
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1640 ms |
82540 KB |
Output is partially correct - maxAccess = 11, score = 91 |