P15404 [NOISG 2026 Prelim] Exquisite Pagoda (No testdata yet)
Description
Little W has $n$ building blocks, and the size of the $i$-th block is $a_i$. Define an "Exquisite Pagoda" as $k$ consecutive blocks $b_1, \ldots, b_k$, and for every $1 \le j < k$ it satisfies $b_j - b_{j+1} \ge r$.
You need to find the maximum number of disjoint $k$-element sets that can be chosen, such that each set can be rearranged to become an "Exquisite Pagoda".
Input Format
- The first line contains three integers $n, k, r$.
- The second line contains $n$ integers $a_1, a_2, \ldots, a_n$.
Output Format
Output one integer, representing the maximum number of "Exquisite Pagodas" that can be formed.
Explanation/Hint
### Constraints
- $1 \le n, k \le 10^6$.
- $0 \le a_i, r \le 10^9$.
### Subtasks
|Subtask ID|Constraints|Points|
|:-:|:-:|:-:|
|1|$n \le 6$|10|
|2|$a_i = i$|20|
|3|$r \le 10$|30|
|4|No special constraints|40|
Translated by ChatGPT 5