Logo
(追記) (追記ここまで)

19026번 - Jump Jump Jump 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 512 MB154330.000%

문제

The rabbit starts at point $(0, 0)$ on the plane. The are $k$ distinct vectors $(dx_1, dy_1),ドル $(dx_2, dy_2),ドル $\ldots,ドル $(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 \geq 1$. Once the rabbit jumps into a trap, it gets trapped and can not move anymore.

For each $x$ such that 1ドル \leq x \leq 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ドル \leq n \leq 10^5,ドル 1ドル \leq k \leq 16$).

Each of the following $k$ lines contains two integers $dx_i$ and $dy_i$ (0ドル \leq dx_i, dy_i \leq 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 \cdot B^{-1} \bmod 998,244円,353円$.

제한

예제 입력 1

5 3
0 0
0 1
1 0

예제 출력 1

499122177
873463809
935854081
959250433
970948609

힌트

The probabilities are $\frac{1}{2}, \frac{1}{8}, \frac{1}{16}, \frac{5}{128}, and \frac{7}{256}$.

출처

Camp > Petrozavodsk Programming Camp > Summer 2018 > Day 8: Yuhao Du Contest 5, Grand Prix of Zhejiang J번

Contest > Open Cup > 2018/2019 Season > Stage 1: Grand Prix of Zheijang J번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /