#P10207. [JOI 2024 Final] 马拉松比赛 2 / Marathon Race 2
[JOI 2024 Final] 马拉松比赛 2 / Marathon Race 2
Problem Description
JOI Avenue is an east-west road with length meters. A location is the point that is meters from the west end of the road.
This year, a marathon event is held on JOI Avenue for the first time. The rules of this marathon are different from usual, and it is run in the following way:
- There are balls placed on the road. The -th ball is placed at location . There may be multiple balls placed at the same location.
- A participant starts from the designated start point, collects all balls, and is considered to have finished if they reach the designated goal point within the designated time limit. However, if they put down any collected ball on the ground, they will be disqualified.
The start point, goal point, and time limit of this event have not been announced yet, but possible plans have been announced. In the -th plan, the start point is location , the goal point is location , and the time limit is seconds.
Rie is one of the athletes in the marathon event. It takes her second to pick up one ball, and running meter on the road while carrying balls takes seconds.
Given the information about JOI Avenue, the balls, and the plans, write a program to determine for each plan whether Rie can finish.
Input Format
The first line contains two integers .
The second line contains integers separated by spaces.
The third line contains one integer .
The next lines each contain three integers , representing the -th plan.
Output Format
Output lines. On the -th line, output Yes if Rie can finish in the -th plan; otherwise output No.
3 100
30 80 30
3
0 100 403
0 100 300
0 100 262
Yes
Yes
No
3 100
30 80 30
3
0 0 403
0 0 300
0 0 262
Yes
No
No
6 100
0 50 100 0 50 100
4
20 70 600
70 20 600
10 40 600
40 10 600
No
Yes
No
Yes
Hint
For all input data, the following conditions are satisfied:
The detailed additional constraints and scores for subtasks are shown in the table below.
| Subtask | Additional Constraints | Score |
|---|---|---|
| 1 | $N \leq 7, Q \leq 10, S_{j}=0, G_{j}=0\ (1 \leq j \leq Q)$ | 7 |
| 2 | ||
| 3 | 10 | |
| 4 | 28 | |
| 5 | 10 | |
| 6 | 19 | |
| 7 | No additional constraints. |
Translated by ChatGPT 5