Value of the Array
Time limit1sMemory limit512 MB
For each k from 1 to n, sum over all non-empty subsequences the sum of their min(size, k) largest elements, modulo 998244353.
- Level
Hard8 of 10
- Topics
- Combinatorics, Sorting, Math, Prefix sum
- Solved
- No attempts yet
Problem
Yuta has a sequence of integers and a number . For any non-empty subsequence of this sequence, the value of is the sum of the largest numbers in . The value of the array is the sum of the values of all its non-empty subsequences.
Yuta shows the integers and wants to know the value of the array for each .
Input
The first line contains an integer (), the length of the sequence Yuta has. The second line contains integers (), the sequence itself.
Output
Print one line with exactly integers. The -th number must be the value of the array when . The answers may be very large, so print them modulo .