Welcome to ZOJ
 Problem Sets Information Select Problem Runs Ranklist
ZOJ Problem Set - 3398
Warden

Time Limit: 2 Seconds      Memory Limit: 65536 KB

War3(short for Warcraft3) is a very famous game. BoMb is also a fans of War3-solo. His favourite race is Night-Elf, and Warden is his favourite hero. One day, BoMb and Little Prince is playing War3-solo in the popular map Turtle Rock, Prince chooses Human race to fight with BoMb, and his first hero is Archmage! Now BoMb has got a chance to win the game because his hero Warden meets Archmage face to face in a very narrow path. Archmage can only choose to escape, that is, run directly to his base. If Archmage arrives his base, he will be protected by Paladin. So Warden must chase after him and use her powerful skills to kill Archmage before he arrives his base.

Warden has 3 skills(all of them will consume mana point):

1.Fan of Knives: After t1 seconds to prepare the skill and consume p1 mana points, Warden will throw thousands of small knives, if the distance between Warden and her enemy is no more than r1 metres when Warden is ready to release the skill, then the enemy will decrease h1 hp.

2.Shadow Strike: After t2 seconds to prepare the skill and consume p2 mana points, Warden will shoot out a poisoned knife if the distance between Warden and her enemy is no more than r2 metres when Warden is ready to release the skill. The initial damage is h2 hp. Then for the next T seconds, the speed of Archmage will decrease to 1.

3.Blink: consume p3 mana points, Warden can freely move front or back at most r3 metres and she needs 1 second to arrive the destiny. This skill does not need time to prepare.

now given the initial distance between Archmage and enemybase ( s0 ), the initial distance between Warden and enemybase ( s1 ), the speed of Archmage ( v0 ), the speed of Warden ( v1 ), the initial mana point of Warden ( m0 ), the initial hp of Archmage ( h0 ), please calculate whether or not Warden can kill Archmage.

There are some details you must notice:

#When Warden is preparing one skill, she cannot move nor use any other skills. Releasing a skill dose not cost any time

#Archmage will always try to run to his base.

#Warden and Archmage are in a straight line and they can only move in straight direction. Besides, the path is so narrow that it can only allow one hero to pass. So when Warden is chasing after Archmage, if she is faster than Archmage and the distance between them is zero, then Warden's speed must be decreased to the same with Archmage. In this situation, we say Warden is blocked by Archmage. However, Warden can use Blink to move in front of Archmage to block him! When Archmage is blocked by warden, he has no way to go, which means Warden can freely attack him. But we must guarantee that Warden has enough mana points to kill Archmage, or she will be killed by Archmage's reinforcement.

#When Warden is chasing after Archmage, if she use blink and just make the distance between Archmage and herself decrease to zero, then she is still being blocked by Archmage.

#We guarantee that in the initial state, Warden is always chasing after Archmage, Archmage won't be blocked by warden at the beginning.

#The unit of speed is metre per second, unit of time is second, unit of distance is metre.What's more, the smallest time unit of every action is measured by second. For example, suppose the speed of Warden is 5m/s, if she wants to move, she must move at least 5m, or 10m, 15m, and so on.

#If Archmage is already poisoned and Warden use another Shadow Strike, then the poison lasting time will be refreshed to T second.

#### Input

The first line of input is an integer M indicating the number of test cases. In each case, there are four lines. First line contains 6 integers: s0, s1, v0, v1, m0, h0, as described above. Second line contains 4 integers: t1, p1, r1, h1. Third line contais 5 integers: t2, p2, r2, h2, T. Fourth line contains 2 integers: p3, r3. All the variables are positive integers and are no more than 30.

#### Output

For each case, output one line. If Warden can kill Archmage, output "yes". Otherwise, output "no".

```1
29 30 5 5 30 20
1 1 10 10
1 1 10 10 10
10 10
```

#### Sample Output

```yes
```

Author: HUANG, Qiao
Contest: ZOJ Monthly, September 2010
Submit    Status