AtCoder Regular Contest 139
D
Priority Queue 2
AtCoder
⌀ 2816
原题
← CE →
翻译中…

Problem Statement

翻译中…

You are given a multiset of integers with $N$ elements: $A=\lbrace A_1,A_2,...,A_N \rbrace$. It is guaranteed that every element of $A$ is between $1$ and $M$ (inclusive).

翻译中…

Let us repeat the following operation $K$ times.

翻译中…
  • Choose an integer between $1$ and $M$ (inclusive) and add it to $A$. Then, delete the $X$-th smallest value in $A$.
翻译中…

Here, the $X$-th smallest value in $A$ is the $X$-th value from the front in the sequence of the elements of $A$ sorted in non-decreasing order.

翻译中…

There are $M^K$ ways to choose an integer $K$ times between $1$ and $M$. Assume that, for each of these ways, we have found the sum of the elements of $A$ after the operations with the corresponding choices. Find the sum, modulo $998244353$, of the $M^K$ values computed.

翻译中…

Constraints

翻译中…
  • $1 \le N,M,K \le 2000$
  • $1 \le X \le N+1$
  • $1 \le A_i \le M$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N M K X
A_1 A_2 \dots A_N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
2 4 2 1
1 3
Output #1
99
We start with $A=\{1,3\}$. Here is an example of how we do the operations. - Add $4$ to $A$, making $A=\{1,3,4\}$. Then, delete the $1$-st smallest value, making $A=\{3,4\}$. - Add $3$ to $A$, making $A=\{3,3,4\}$. Then, delete the $1$-st smallest value, making $A=\{3,4\}$. In this case, the sum of the elements of $A$ after the operations is $3+4=7$.
Input #2
5 9 6 3
3 7 1 9 9
Output #2
15411789
题目信息
题号
arc139_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。