Japanese Knowledge
Time limit10sMemory limit512 MB
For each k from 0 to N, count non-decreasing sequences x with x_i at most A_i in which exactly k positions have x_i equal to A_i, modulo 998244353.
- Level
Hard9 of 10
- Topics
- Dynamic programming, Divide and conquer, Combinatorics, Math
- Solved
- No attempts yet
Problem
This problem might be well-known in some countries, but how do other countries learn about such problems if nobody poses them?
You are given a non-decreasing positive integer sequence of length . For each , count the number of non-decreasing non-negative integer sequences of length that satisfy the following conditions, modulo .
- for all .
- The number of indices with is exactly .
Input
The first line contains an integer ().
The second line contains integers ().
Output
For each , print the answer.