Yet Another Sequence Related Problem

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

There are two sequences of integers, A_1..N+M1A\_{1..N+M-1} and B_1..NB\_{1..N}. The sequence B_1..NB\_{1..N} is obtained by aggregating the maximum value of every MM consecutive elements in AA, or formally, B_i=max_0jM1A_i+jB\_i = \max\_{0≤j≤M−1}{A\_{i+j}} for all i=1..Ni = 1..N.

Due to the COVID-19 pandemic, AA is completely lost. To make matters worse, zero or more elements in BB are also missing. Fortunately, you remember that each element in AA and BB are between 11 and KK (inclusive).

It doesn’t take you a long time to realize that there might be more than one possibility for an AA sequence that is consistent with the given BB. Your task in this problem is to figure out how many such possible AA sequences are there if possible. Since the output can be very big, you only need to output its positive remainder when divided by 998,244,353998\\,244\\,353.

입력

Input begins with a line containing three integers NN MM KK (1N,M,K100,0001 ≤ N, M, K ≤ 100\\,000) representing the length of BB, the number of consecutive elements in AA to make BB, and the upper bound of any elements in AA, respectively. The next line contains NN integers B_iB\_i (B_i1,1,2,,KB\_i ∈ \\{-1, 1, 2, \dots , K\\}) representing the given sequence of BB. Any missing element in BB is represented by 1-1.

출력

Output in a line an integer representing the number of possible AA modulo 998,244,353998\\,244\\,353.