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