int encode(int x, int y, int n) {
for(int i = 0; i < 10; i++) {
int sk = (1 << i);
if((x & sk) != (y & sk)) {
return i * 2 + ((bool)(x&sk));
}
}
return -1;
}
int decode(int q, int h, int n) {
// return "yes", jei q = x, return "no", jei q = y
int vl = h & 1;
int ind = h / 2;
if( ((bool)(q & (1 << ind))) == vl) {
return 1;
}else {
return 0;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
472 KB |
the encoded value must be greater than or equal to 1 |
2 |
Incorrect |
0 ms |
488 KB |
the encoded value must be greater than or equal to 1 |