Jump Jump Jump
Time limit5sMemory limit512 MB
Given k jump vectors with coordinates up to 3, find for each x up to n the probability that a random walk from (0, 0) first lands on the diagonal point (x, x).
- Level
Hard9 of 10
- Topics
- Probability, Dynamic programming, Math
- Solved
- No attempts yet
Problem
The rabbit starts at point on the plane. There are distinct vectors . On each step, the rabbit chooses one vector with equal probability and jumps from its current point to . All choices are independent.
There are traps at all lattice points for . Once the rabbit jumps into a trap, it is trapped and cannot move anymore.
For each such that , output the probability that the rabbit gets trapped at the lattice point .
Input
The first line contains two integers and (, ).
Each of the following lines contains two integers and (). All the vectors are distinct.
Output
Print lines. On line , print the probability that the rabbit is trapped at the lattice point .
It is guaranteed that the probability can be written as a fraction where is coprime to 998244353. Print .
Hint
The probabilities are , and .