P17460 [CodeChef] TANDJ1
普及-
题目描述

Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

There is a grid of size $10^{5} \times 10^{5},$ covered completely in railway tracks. Tom is riding in a train, currently in cell (a, b), and Jerry is tied up in a different cell (c, d), unable to move. The train has no breaks. It shall move exactly K steps, and then its fuel will run out and it shall stop. In one step, the train must move to one of its neighboring cells, sharing a side. Tom can’t move without the train, as the grid is covered in tracks. Can Tom reach Jerry’s cell after exactly K steps?

Note: Tom can go back to the same cell multiple times.

------ Input Format ------

  • The first line contains an integer T, the number of test cases. Then the test cases follow.
  • Each test case contains a single line of input, five integers a, b, c, d, K.

------ Output Format ------

For each testcase, output in a single line "YES" if Tom can reach Jerry's cell in exactly K moves and "NO" if not.

You may print each character of the string in uppercase or lowercase (for example, the strings "yEs", "yes", "Yes" and "YES" will all be treated as identical).

------ Constraints ------

$1 ≤ T ≤ 10^{5}$
$0 ≤ a, b, c, d ≤ 10^{5}$
$(a, b) \ne (c, d)$
$1 ≤ K ≤ 2 \cdot 10^{5}$

------ subtasks ------

Subtask #1 (100 points): original constraints

----- Sample Input 1 ------
3

1 1 2 2 2

1 1 2 3 4

1 1 1 0 3
----- Sample Output 1 ------
YES

NO

YES
----- explanation 1 ------
Test Case $1$: A possible sequence of moves is $(1, 1) \to (1, 2) \to (2, 2)$.

Test Case $2$: There is a possible sequence in $3$ moves, but not in exactly $4$ moves.

Test Case $3$: A possible sequence of moves is $(1, 1) \to (1, 0) \to (0, 0) \to (1, 0)$.

输入格式

见题面

输出格式

见题面

样例输入
3 1 1 2 2 2 1 1 2 3 4 1 1 1 0 3
样例输出
YES NO YES