좌표가 음이 아닌 k개의 서로 다른 점프 벡터가 주어질 때, (0,0)에서 출발한 토끼가 각 x에 대해 대각선 점 (x,x)에 처음으로 갇힐 확률을 n까지 구한다.
어려움8동적 계획법조합론수학확률아직 제출이 없습니다시간 제한5초메모리 제한512 MBThe rabbit starts at point (0,0) on the plane. The are k distinct vectors (dx_1,dy_1), (dx_2,dy_2), …, (dx_k,dy_k). On each step, the rabbit will choose one vector (dx_c,dy_c) randomly with the same probability, and then jump from its current point (x,y) to (x+dx_c,y+dy_c). All choices are independent.
There are traps in all the lattice points (x,x) for all x≥1. Once the rabbit jumps into a trap, it gets trapped and can not move anymore.
For each x such that 1≤x≤n, output the probability that the rabbit gets trapped in the lattice point (x,x).
The first line contains two integers n and k (1≤n≤105, 1≤k≤16).
Each of the following k lines contains two integers dx_i and dy_i (0≤dx_i,dy_i≤3) in each line. All the vectors are distinct.
Print n lines. On line x, print the probability that the rabbit is trapped in the lattice point (x,x). It is guaranteed that the probability can be represented as a fraction A/B where B is coprime to 998,244,353, so output it as A⋅B−1mod998,244,353.
The probabilities are 21,81,161,1285,and2567.