#include "cmp.h"
int jmp[9] = {0, 4, 4+16, 4+16+64, 4+16+64+256, 4+16+64+256+1024};
void remember(int n) {
for(int i=5;i>=0;--i)
bit_set((n>>2*i)+jmp[i]);
}
int compare(int b) {
int lower = -1, upper = 6;
while (upper-lower>1)
{
int mid=lower+(upper-lower)/2;
int div = 5-mid;
if (bit_get((b>>2*div)+jmp[div])) lower=mid;
else upper=mid;
}
if (lower == 5)
return 0;
int P = (b>>2*lower)*4+jmp[lower+1];
int db = (b>>(2*lower-2))&4;
if (db == 0)
return -1;
if (db == 3)
return 1;
if (db == 1)
{
if (bit_get(P))
return 1;
return -1;
}
if (bit_get(P+3))
return -1;
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2392 KB |
ZERO POINTS: bit_set with addr out of range 0 |