#P15133. [ROIR 2026] 最后的滑动窗口问题
[ROIR 2026] 最后的滑动窗口问题
Problem Description
Consider a numeric array . A sliding window of length () on this array refers to all subsegments of length , i.e. , , , .
Given a numeric array of length , answer queries about this array. Each query is as follows: for given , , and , find the sum of the minimum values of all sliding windows of length on the subsegment .
Input Format
The first line contains two integers and (), the length of the array and the number of queries.
The second line contains integers (), the values in the array.
The next lines describe the queries. The -th line contains three integers , , and (, ), the left and right boundaries of the subsegment and the sliding window length for the -th query.
Output Format
Output lines, each containing the answer to the corresponding query. On the -th line, output one number, the sum of the minimum values of all sliding windows of length on the subsegment .
6 3
4 6 1 2 5 3
2 5 2
2 4 1
1 6 6
4
9
1
Hint
| Subtask | Score | Additional Constraints | Dependencies |
|---|---|---|---|
| 1 | 6 | ||
| 2 | 12 | 1 | |
| 3 | 8 | 1–2 | |
| 4 | 11 | ||
| 5 | 10 | All queries have the same | |
| 6 | 14 | ||
| 7 | 6 | ||
| 8 | 15 | ||
| 9 | 17 | No additional constraints | 1–8 |
Translated by ChatGPT 5