[Login|Register]
Problems

Status

Rank

Problem 1235
JUMP
Time Limit: 1000ms
Memory Limit: 65536kb
Description
There is n pillar, their heights are (A1,A2,A3,…An).you can jump at the top of the pillars. But you will lose abs(a[j]-a[i])*abs(j-i) power when you jump from i-th pillar to j-th pillar. At first you have m power. Can you jump from s-th pillar to e-th pillar.
Input
The input consists of several test cases.
every test case is two integer n(2<=n<200),q(1<=q<=10000).
The second line contain n integer A1,A2,A3,..An.
The next q line contain there integer s,e,m.
Output
If you can jump from s to e, with less or equal m power output "Yes", else output "No".
Sample Input
3 3
1 2 3
1 3 2
1 2 1
1 3 1
Sample Output
Yes
Yes
No
Hint
Abs(a-b) mean the absolute value of a-b.
University of Science and Technology of China
Online Judge for ACM/ICPC
Processed in 1.3ms with 1 query(s).