Two Squares

题意翻译

## 题目描述 给出两个正方形,其中一个正方形的边恰好与坐标轴平行,而另一个呈 $45\degree$ 角倾斜。 请你判断这两个正方形是否重叠。(如果两个正方形有点或边重合了,也算作重叠) ## 输入格式 第 $1$ 行,有 $4$ 对整数,表示竖直的正方形每个顶点的坐标。 第 $2$ 行,有 $4$ 对整数,表示倾斜 $45\degree$ 的正方形每个顶点的坐标。 保证每个正方形的 $4$ 个顶点会按顺时针或逆时针方向给出。 (数据范围: $-100 \leqslant$ 输入的所有数 $\leqslant 100$ ) ##输出格式 如果两个正方形重叠,输出 $Yes$ ,否则输出 $No$ 。 你输出的答案大小写可以任意。 ##提示与说明 - 第 $1$ 组样例的解释: 因为第 $2$ 个正方形完全被第 $1$ 个正方形包含,也算作重叠,故输出 $Yes$ 或 $YES$ 。 - 第 $2$ 组样例的解释: 因为两个正方形完全没有重叠,故输出 $No$ 或 $NO$ 。 - 第 $3$ 组样例的解释: 因为两个正方形有一小部分重叠,故输出 $Yes$ 或 $YES$ 。 每个样例对应的图像如下所示。 感谢@Sooke 提供翻译

题目描述

You are given two squares, one with sides parallel to the coordinate axes, and another one with sides at 45 degrees to the coordinate axes. Find whether the two squares intersect. The interior of the square is considered to be part of the square, i.e. if one square is completely inside another, they intersect. If the two squares only share one common point, they are also considered to intersect.

输入输出格式

输入格式


The input data consists of two lines, one for each square, both containing 4 pairs of integers. Each pair represents coordinates of one vertex of the square. Coordinates within each line are either in clockwise or counterclockwise order. The first line contains the coordinates of the square with sides parallel to the coordinate axes, the second line contains the coordinates of the square at 45 degrees. All the values are integer and between $ -100 $ and $ 100 $ .

输出格式


Print "Yes" if squares intersect, otherwise print "No". You can print each letter in any case (upper or lower).

输入输出样例

输入样例 #1

0 0 6 0 6 6 0 6
1 3 3 5 5 3 3 1

输出样例 #1

YES

输入样例 #2

0 0 6 0 6 6 0 6
7 3 9 5 11 3 9 1

输出样例 #2

NO

输入样例 #3

6 0 6 6 0 6 0 0
7 4 4 7 7 10 10 7

输出样例 #3

YES

说明

In the first example the second square lies entirely within the first square, so they do intersect. In the second sample squares do not have any points in common. Here are images corresponding to the samples: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF993A/f8102740f8dd340ce96d2e890e6a5eb7f7ba967c.png) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF993A/b233c18cac59a3034c332be17b81dbd753c4aadb.png) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF993A/7cde5048b56e57f2c4d748e48e7ab15318414885.png)