int encode(int n, int x, int y) {
for(int i = 0; i < 10; i++) {
if((x & (1 << i)) && !(y & (1 << i)))
return i + 1;
}
x = __builtin_popcount(x);
y = __builtin_popcount(y);
for(int i = 0; i < 4; i++) {
if(!(x & (1 << i)) && (y & (1 << i)))
return i + 11;
}
return 0;
}
int decode(int n, int q, int h) {
if(h <= 10)
return (q & (1 << (h - 1))) > 0;
q = __builtin_popcount(q);
return (q & (1 << (h - 11))) == 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2984 ms |
24064 KB |
Output is partially correct - maxh = 14 |
2 |
Partially correct |
3063 ms |
24056 KB |
Output is partially correct - maxh = 14 |