int lsb(int x)
{
return ((x^(x-1))&x);
}
int norm[2000];
int encode (int n, int x, int y) {
for(int i=0;i<=9;i++)
norm[(1<<i)]=i+1;
return norm[lsb((x^y))]+10*((lsb((x^y))&x)!=0);
}
int decode (int n, int q, int h) {
int ret=0;
if(h>10)
{
h-=11;
if((q&(1<<h))) ret=1;
else ret=0;
}
else
{
h--;
if((q&(1<<h))) ret=0;
else ret=1;
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1281 ms |
80880 KB |
Output is partially correct - maxh = 20 |
2 |
Partially correct |
1270 ms |
81160 KB |
Output is partially correct - maxh = 20 |