Problem B
Exactly Electrical
You live in Grid City, which is composed of integer-numbered
streets which run east-west (parallel to the
You drive a special electric car which uses up one unit of electrical charge moving between adjacent intersections: that is, moving either north or south to the next street, or moving east or west to the next avenue). Until your battery runs out, at each intersection, your car can turn left, turn right, go straight through, or make a U-turn. You may visit the same intersection multiple times on the same trip.
Suppose you know your starting intersection, your destination intersection and the number of units of electrical charge in your battery. Determine whether you can travel from the starting intersection to the destination intersection using the charge available to you in such a way that your battery is empty when you reach your destination.
Input
The input consists of three lines. The first line contains
The second line contains
The third line contains an integer
Output
Output Y if it is possible to move
from the starting coordinate to the destination coordinate
using exactly
Sample Input 1 | Sample Output 1 |
---|---|
3 4 3 3 3 |
Y |
Sample Input 2 | Sample Output 2 |
---|---|
10 2 10 4 5 |
N |