CF1677F.Tokitsukaze and Gems

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Tokitsukaze has a sequence with length of nn . She likes gems very much. There are nn kinds of gems. The gems of the ii -th kind are on the ii -th position, and there are aia_i gems of the same kind on that position. Define G(l,r)G(l,r) as the multiset containing all gems on the segment [l,r][l,r] (inclusive).

A multiset of gems can be represented as S=[s1,s2,,sn]S=[s_1,s_2,\ldots,s_n] , which is a non-negative integer sequence of length nn and means that SS contains sis_i gems of the ii -th kind in the multiset. A multiset T=[t1,t2,,tn]T=[t_1,t_2,\ldots,t_n] is a multisubset of S=[s1,s2,,sn]S=[s_1,s_2,\ldots,s_n] if and only if tisit_i\le s_i for any ii satisfying 1in1\le i\le n .

Now, given two positive integers kk and pp , you need to calculate the result of

$$\sum_{l=1}^n \sum_{r=l}^n\sum\limits_{[t_1,t_2,\cdots,t_n] \subseteq G(l,r)}\left(\left(\sum_{i=1}^n p^{t_i}t_i^k\right)\left(\sum_{i=1}^n[t_i>0]\right)\right), $$ </p><p>where $\[t\_i>0\]=1$ if $t\_i>0$ and $\[t\_i>0\]=0$ if $t\_i=0$ .</p><p>Since the answer can be quite large, print it modulo $998\\,244\\,353$$$.

输入格式

The first line contains three integers nn , kk and pp ( 1n1051\le n \le 10^5 ; 1k1051\le k\le 10^5 ; 2p9982443512\le p\le 998\,244\,351 ) — the length of the sequence, the numbers kk and pp .

The second line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n ( 1ai9982443511\le a_i\le 998\,244\,351 ) — the number of gems on the ii -th position.

输出格式

Print a single integers — the result modulo 998244353998\,244\,353 .

输入输出样例

  • 输入#1

    5 2 2
    1 1 1 2 2

    输出#1

    6428
  • 输入#2

    6 2 2
    2 2 2 2 2 3

    输出#2

    338940
首页