시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 24 | 13 | 11 | 55.000% |
A permutation $p$ on $n$ elements is an involution if $p(p(i)) = i$ for each $i$ from $1$ to $n$ inclusive. Your task is to compute the number of involutions on $n$ elements with $k$ inversions. To make your life easier, we ask you to print only the parity of this number.
In the only line of the input, two space-separated integers are given: $n$ ($1 \le n \le 500$), the length of the involution, and $k$ ($0 \le k \le \frac{n(n-1)}{2}$), the number of inversions.
Print a single number ($0$ or $1$): the number of involutions on $n$ elements with exactly $k$ inversions, when taken modulo $2$.
4 1
1
10 21
0
In the first sample, there are $3$ such involutions.