#P16782. ⌈Xzy OI R1 T4⌋ 吃吃冰
⌈Xzy OI R1 T4⌋ 吃吃冰
Background
The input size of this problem is large. Please choose a suitable input method.
For each partial score level of this problem, the time limit is times that of the corresponding std. If your solution cannot pass, please check whether your time complexity is correct.
@Nuclear_Fish_cyq : I【】really【】feel magical. || @Nuclear_Fish_cyq : If this problem is not fake, I will name it drug, because it is too magical.
Problem Description
Ziyaqiu is on a grid with rows, and its initial coordinate is . The last row has shaved ices. Each shaved ice has an attribute called “deliciousness”, which are .
Now Ziyaqiu wants to start from and walk steps. In each step, Ziyaqiu moves down by cell, and then it can choose any number in and move right by cells.
Obviously, Ziyaqiu can always end up on a shaved ice. Different walking plans may lead to different or the same deliciousness. Ziyaqiu wants you to compute the sum of the deliciousness values brought by all walking plans, modulo .
Input Format
The first line contains two positive integers .
The next line contains integers, representing the deliciousness of the shaved ices in the last row.
Output Format
Output one positive integer in one line, representing the answer.
4 3
0 1 2 3 4 5 6 7 8 9
288
2 1
1 -1
0
Hint
Constraints
This problem uses bundled testdata, i.e. you must pass all test points in a subtask to get the score for that subtask.
::cute-table{tuack}
| Subtask | Score | Time limit | ||
|---|---|---|---|---|
| 2000ms | ||||
| ^ | ^ | |||
| ^ | 750ms | |||
| 125ms | ||||
For of the data, .
Translated by ChatGPT 5