PivotOJ

Marathon Race 2

시간 제한: 1500ms메모리 제한: 1024MB출처: JOI 2023-2024 본선BOJ 31625

문제

JOI Avenue is a road of length LL in an east-west direction. The place of ll meters (0 ≤ l ≤ L) from the west end on the road is called ”position ll”.

The first marathon race in JOI Avenue is going to be held this year. The race has a different regulation from normal one, which is described in the following:

  • Before the race, NN balls are located on the road. The ii-th ball (1 ≤ i ≤ N) is located at position XiX_i. Multiple balls may be located at the same position.
  • The participant starts at the designated position.
  • The participant collects all NN balls and finishes at the designated position. When this is achieved within the designated time limit, one completes the race. However, once the participant collect a ball, they must not put the ball on the road, otherwise they will be disqualified from the race.

The starting and finishing position, and the time limit, are not yet announced, but it is known that they are chosen from QQ scenarios. The jj-th scenario (1 ≤ j ≤ Q) is that, the participant starts at position SjS_j, finishes at position GjG_j, and the time limit is TjT_j seconds.

Rie is participating in the marathon race. She spends 11 second to collect 11 ball. She spends x+1x + 1 seconds to move 11 meter, where xx is the number of balls she is carrying.

Write a program which, given the information of JOI Avenue, the positions of balls, and the scenarios, determines whether there exists a way for Rie to complete the race, for each scenario.

입력

Read the following data from the standard input.

NN LL

X1X_1 X2X_2 \cdots XNX_N

QQ

S1S_1 G1G_1 T1T_1

S2S_2 G2G_2 T2T_2

\vdots

SQS_Q GQG_Q TQT_Q

출력

Write QQ lines to the standard output. On the jj-th line (1 ≤ j ≤ Q), output Yes if there exists a way for Rie to complete the race for scenario jj, and No otherwise.

예제

예제 1

입력
3 100
30 80 30
3
0 100 403
0 100 300
0 100 262
출력
Yes
Yes
No

예제 2

입력
3 100
30 80 30
3
0 0 403
0 0 300
0 0 262
출력
Yes
No
No

예제 3

입력
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
코드를 제출하려면 로그인하세요.