CF1677F.Tokitsukaze and Gems
NOI/NOI+/CTSC
通过率:0%
时间限制:4.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Tokitsukaze has a sequence with length of n. She likes gems very much. There are n kinds of gems. The gems of the i-th kind are on the i-th position, and there are ai gems of the same kind on that position. Define G(l,r) as the multiset containing all gems on the segment [l,r] (inclusive).
A multiset of gems can be represented as S=[s1,s2,…,sn], which is a non-negative integer sequence of length n and means that S contains si gems of the i-th kind in the multiset. A multiset T=[t1,t2,…,tn] is a multisubset of S=[s1,s2,…,sn] if and only if ti≤si for any i satisfying 1≤i≤n.
Now, given two positive integers k and p, 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 \\gt 0\]\\right)\\right),where [ti>0]=1 if ti>0 and [ti>0]=0 if ti=0.
Since the answer can be quite large, print it modulo 998244353.
Tokitsukaze 有一个长度为 n 的序列。她非常喜欢宝石。一共有 n 种宝石,第 i 种宝石位于第 i 个位置,该位置上有 ai 颗同种宝石。定义 G(l,r) 为区间 [l,r](含端点)上所有宝石构成的多重集。
一个宝石多重集可表示为 S=[s1,s2,…,sn],即一个长度为 n 的非负整数序列,其含义是:多重集 S 中包含 si 颗第 i 种宝石。多重集 T=[t1,t2,…,tn] 是多重集 S=[s1,s2,…,sn] 的多重子集,当且仅当对任意满足 1≤i≤n 的 i,均有 ti≤si。
现给定两个正整数 k 和 p,你需要计算下列表达式的值:
l=1∑nr=l∑n[t1,t2,⋯,tn]⊆G(l,r)∑((i=1∑nptitik)(i=1∑n[ti>0])),
其中 [ti>0]=1 当 ti>0,否则 [ti>0]=0。
由于答案可能非常大,请将结果对 998244353 取模后输出。
输入格式
The first line contains three integers n, k and p (1≤n≤105; 1≤k≤105; 2≤p≤998244351) — the length of the sequence, the numbers k and p.
The second line contains n integers a1,a2,…,an (1≤ai≤998244351) — the number of gems on the i-th position.
第一行包含三个整数 n、k 和 p(1≤n≤105;1≤k≤105;2≤p≤998244351)—— 分别表示序列长度、数字 k 和 p。
第二行包含 n 个整数 a1,a2,…,an(1≤ai≤998244351)—— 表示第 i 个位置上的宝石数量。
输出格式
Print a single integers — the result modulo 998244353.
输出一个整数——结果对 998244353 取模的值。
输入输出样例
输入#1
5 2 2 1 1 1 2 2
输出#1
6428
输入#2
6 2 2 2 2 2 2 2 3
输出#2
338940
输入解题思路,AI测评打分。不知道怎么写?