#QHD0000017. Mô tả mảng (Array Description)
Mô tả mảng (Array Description)
Array Description
Source: CSES
Version: Phuoc Hung OJ Extended
Problem Statement
This package preserves the original task mechanism. Cho mảng độ dài . Mỗi phần tử bằng nghĩa là chưa xác định, hoặc là một số trong . Cần thay mọi số sao cho hai phần tử kề nhau chênh lệch không quá . Hãy đếm số mảng hợp lệ.
Input
Dòng đầu chứa . Dòng hai chứa số.
Output
In số cách modulo .
Subtasks
- Subtask 1 — 20 points: small data.
- Subtask 2 — 30 points: medium data.
- Subtask 3 — 50 points: full PHOJ package limits.
Examples
Input
3 5
2 0 2
Output
3
Explanation
The output follows directly from the rules above.