#include <assert.h>
int encode (int n, int x, int y) {
for(int step=1;step<=10;step++)
{
int a=0,b=0;
for(int i=0;i<10;i+=step)
{
a^=x>>i&1;
b^=y>>i&1;
}
if(a!=b) return (step-1)*2+a+1;
}
assert(0);
return -1;
}
int decode (int n, int q, int h) {
h--;
int step=h/2+1,a=0;
for(int i=0;i<10;i+=step) a^=q>>i&1;
if(a==h%2) return 1;
else return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1676 ms |
125480 KB |
Output is partially correct - maxh = 20 |
2 |
Partially correct |
1658 ms |
125144 KB |
Output is partially correct - maxh = 20 |