atcoder#AGC062E. [AGC062E] Overlap Binary Tree

[AGC062E] Overlap Binary Tree

Score: 13001300 points

Problem Statement

You are given an odd number NN and a non-negative integer KK.

Find the number, modulo 998244353998244353, of sequences of integer pairs ((L1,R1),(L2,R2),,(LN,RN))((L_1,R_1),(L_2,R_2),\dots,(L_N,R_N)) satisfying all of the following conditions.

  • (L1,R1,L2,R2,,LN,RN)(L_1,R_1,L_2,R_2,\dots,L_N,R_N) is a permutation of the integers from 11 to 2N2N.
  • L1L2LNL_1 \leq L_2 \leq \dots \leq L_N.
  • LiRi (1iN)L_i \leq R_i \ (1 \leq i \leq N).
  • There are exactly KK indices i (1iN)i\ (1\leq i \leq N) such that Li+1=RiL_i+1=R_i.
  • There is a rooted binary tree TT with NN vertices numbered from 11 to NN such that the following holds:- vertices ii and jj have an ancestor-descendant relationship in TT     \iff intervals [Li,Ri][L_i,R_i] and [Lj,Rj][L_j,R_j] intersect.
  • vertices ii and jj have an ancestor-descendant relationship in TT     \iff intervals [Li,Ri][L_i,R_i] and [Lj,Rj][L_j,R_j] intersect.

Here, a rooted binary tree is a rooted tree where each vertex has 00 or 22 children. Vertices ii and jj are said to have an ancestor-descendant relationship in a tree TT if either vertex jj exists on the simple path connecting the root to vertex ii, or vice versa.

Constraints

  • 1N<2×1051 \leq N < 2 \times 10^5
  • 0KN0 \leq K \leq N
  • NN is odd.
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN KK

Output

Print the answer.

3 1
2

For example, if (L1,R1)=(1,5),(L2,R2)=(2,3),(L3,R3)=(4,6)(L_1,R_1)=(1,5),(L_2,R_2)=(2,3),(L_3,R_3)=(4,6), then i=2i=2 is the only pair with Li+1=RiL_i+1=R_i. Also, the fifth condition is satisfied by a tree where vertex 11 is the root, and its children are vertices 22 and 33.

1 0
0
521 400
0
199999 2023
283903125