#include "cmp.h"
void remember(int n) {
int k=n/64;
bit_set(k);
for(int i=0;i<12;i++){
if(n&1)
bit_set(64+i);
n/=2;
}
}
int compare(int b) {
int k=b/64;
if(bit_get(k)){
b%=64;
int r=1;
int a=0;
for(int i=0;i<6;i++){
if(bit_get(64+i))
a+=r;
r*=2;
}
if(b<a)
return -1;
else if(b==a)
return 0;
return 1;
}
b/=64;
int r=64;
int a=0;
for(int i=6;i<12;i++){
if(bit_get(64+i))
a+=r;
r*=2;
}
if(b<a)
return -1;
else if(b==a)
return 0;
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
ZERO POINTS: bit_set with addr out of range 0 |