#include "cmp.h"
void remember(int n) {
for (int i = 0; i < 6; ++i) {
bit_set(n);
n >>= 2;
}
}
int compare(int b) {
int ok = 6, ng = -1;
while (ok - ng > 1) {
const int md = (ok + ng) / 2;
if (bit_get(b >> (2 * md))) {
ok = md;
} else {
ng = md;
}
}
if (ok == 0) {
return 0;
}
const int same = b >> (2 * ok);
const int bit = (b >> (2 * ng)) & 3;
if (bit <= 1) {
return bit_get(4 * same) ? 1 : -1;
} else {
return bit_get(4 * same + 3) ? -1 : 1;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
ZERO POINTS: bit_set with addr out of range 0 |