Codeforces Round 1031 (Div. 2)
B
Good Start
Codeforces
1200
原题
← AC →
翻译中…

The roof is a rectangle of size $w \times h$ with the bottom left corner at the point $(0, 0)$ on the plane. Your team needs to completely cover this roof with identical roofing sheets of size $a \times b$, with the following conditions:

翻译中…
  • The sheets cannot be rotated (not even by $90^\circ$).
  • The sheets must not overlap (but they can touch at the edges).
  • The sheets can extend beyond the boundaries of the rectangular roof.
翻译中…

A novice from your team has already placed two such sheets on the roof in such a way that the sheets do not overlap and each of them partially covers the roof.

翻译中…

Your task is to determine whether it is possible to completely tile the roof without removing either of the two already placed sheets.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

翻译中…

The first line of each test case contains four integers $w$, $h$, $a$, and $b$ ($1 \le w, h, a, b \le 10^9$) — the dimensions of the roof and the dimensions of the roofing sheets, respectively.

翻译中…

The second line of each test case contains four integers $x_1$, $y_1$, $x_2$, and $y_2$ ($-a + 1 \le x_1, x_2 \le w - 1, -b + 1 \le y_1, y_2 \le h - 1$) — the coordinates of the bottom left corners of the already placed roofing sheets. It is guaranteed that these sheets do not overlap.

翻译中…

Output

翻译中…

For each test case, output "Yes" (without quotes) if it is possible to completely tile the roof without removing either of the two already placed tiles, and "No" (without quotes) otherwise.

翻译中…

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

翻译中…

Note

翻译中…

In the first test case, it is possible to add $8$ roofing sheets as follows:

翻译中…

image

翻译中…

In the second test case, it is impossible to completely tile the roof:

翻译中…

image

翻译中…

样例

Input #1
7
6 5 2 3
-1 -2 5 4
4 4 2 2
0 0 3 1
10 9 3 2
0 0 4 3
10 9 3 2
0 0 6 3
5 5 2 2
-1 -1 4 -1
5 5 2 2
-1 -1 2 3
7 8 2 4
0 0 0 5
Output #1
Yes
No
No
Yes
No
Yes
No
InputCopy OutputCopy
题目信息
题号
2113B
时间限制
1 s
内存限制
256 MB
标签
构造
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。