#P9684. Hello, Solitude.

    ID: 10664 远端评测题 2000ms 512MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>动态规划 DP多项式洛谷原创O2优化洛谷月赛

Hello, Solitude.

Background

@【data deleted】 : I 【data deleted】. || @【data deleted】 : Which one are you voting for || @【data deleted】 : Yukino vs. Mikoto (sad)

Problem Description

There is a very long table. On one side of the table, there are n+2n+2 chairs, numbered 0,1,,n+10,1,\dots,n+1 from left to right, and the distance between any two adjacent chairs is the same.

Initially, there is one person sitting on chair 00 and one person sitting on chair n+1n+1. Then mm people enter one by one and sit down according to the following rules:

  • First, uniformly at random choose an empty seat.
  • If moving to an adjacent seat can increase the minimum distance to the nearest adjacent person, then move to the adjacent seat. It can be proven that the above operation will definitely stop after a finite number of steps.

For each chair 11 to nn, find the probability that there is someone sitting on it.

Input Format

The first line contains two integers n,mn,m.

Output Format

Output nn lines, each containing one integer. The integer on the ii-th line represents the probability that there is someone sitting on chair ii, taken modulo 998244353998\,244\,353.

6 3
324429415
948332136
224604980
224604980
948332136
324429415

Hint

Explanation of Sample 1

Below is one possible seating process:

  1. Initially, no one sits on chairs 11 to nn.
  2. Choose x=2x=2. The distance to the nearest person (at seat 00) is 22.
    1. After moving right to chair 33, the distance to the nearest person increases to 33, so set xx+1x\gets x+1.
    2. If moving right again to 44, the distance to the nearest person (at seat 66) is still 33, so they sit on chair 33.
  3. Choose x=6x=6. The distance to the nearest person (at seat 77) is 11.
    1. After moving left to chair 55, the distance to the nearest person increases to 22, so set xx1x\gets x-1.
    2. If moving left or right again, the distance to the nearest person will decrease in both cases, so they sit on chair 55.
  4. Choose x=4x=4. Since they cannot move left or right, they directly sit on chair 44.

In the end, chairs 3,4,53,4,5 are occupied.

Constraints

For all testdata, 1n5×1051\le n\le 5\times 10^5, 0mn0\le m\le n.

Subtasks

# Special property Points
0 Sample 0
1 n20n\le20 9
2 n100n\le100 10
3 n500n\le500 12
4 n2000n\le2000 11
5 n5000n\le5000 12
6 kN\exists k\in \mathbb{N} such that n=2k1n=2^k-1 13
7 n105n\le 10^5 15
8 - 18

Translated by ChatGPT 5