#P12151. 【MX-X11-T5】「蓬莱人形 Round 1」俄罗斯方块
【MX-X11-T5】「蓬莱人形 Round 1」俄罗斯方块
Description
Given an integer sequence of length , along with pairs and a positive integer .
For each position , you can perform one of the following operations:
- Activate position : Choose a position satisfying , then update and . Each position can be activated at most once.
- Do not activate position .
There are queries . For each query, under the constraints that only positions can be activated and the corresponding must lie within , determine whether there exists a way to activate positions such that .
Queries are independent: the sequence is restored to its original state at the start of each query, and no activation choices are retained between queries.
Input Format
Multiple test cases.
The first line contains two integers and , representing the subtask number and the number of test cases, respectively. Sample inputs satisfy .
For each test case:
- The first line contains three integers , representing the sequence length, number of queries, and activation range parameter.
- The second line contains integers .
- The third line contains integers .
- The fourth line contains integers .
- The next lines each contain three integers , describing the -th query.
Output Format
For each query, output Yes or No indicating whether a valid activation scheme exists.
0 1
3 2 1
2 0 2
4 1 1
0 8 0
2 3 1
1 3 1
Yes
No
0 2
7 7 3
4 1 2 2 3 2 2
4 1 4 0 3 2 1
3 3 4 1 3 3 0
5 5 4
3 4 5
1 4 3
2 5 0
1 2 3
1 4 5
1 3 4
7 7 3
5 2 1 5 2 5 2
4 2 1 4 3 1 2
1 5 3 4 1 5 1
6 7 5
1 4 5
2 4 5
5 7 5
1 2 5
3 4 5
2 6 5
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Hint
Explanation #1
Sample 1 Explanation:
For the query , activating position updates to and to . The maximum value in is , satisfying the condition.
For the query , no valid activation exists.
Constraints
This problem uses subtask scoring.
For all test data: , , , , , .
| Subtask | Special Property | Points | Time Limit | ||||
|---|---|---|---|---|---|---|---|
| 1 | 10 | 5 | 3 | None | 5 | 1 s | |
| 2 | 1000 | 1 | 10 | ||||
| 3 | 3 | A | 4 s | ||||
| 4 | 3 | 1 | B | 5 | 1 s | ||
| 5 | None | 10 | |||||
| 6 | 4 | B | 5 | ||||
| 7 | None | 10 | |||||
| 8 | 2 | B | 5 | ||||
| 9 | None | 10 | |||||
| 10 | 5 | 3 | 30 | 4 s | |||
- Special Property A: For all queries, and .
- Special Property B: For all queries, for any .
Note: Be mindful of the problem's time limits.
Translated by DeepSeek R1
京公网安备 11011102002149号