Codeforces Round 488 by NEAR (Div. 1)
A
Two Squares
Codeforces
1600
原题
←B →
翻译中…

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.

翻译中…

Input

翻译中…

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$.

翻译中…

Output

翻译中…

Print "Yes" if squares intersect, otherwise print "No".

翻译中…

You can print each letter in any case (upper or lower).

翻译中…

Note

翻译中…

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:

翻译中…

image

翻译中…

image

翻译中…

image

翻译中…

样例

Input #1
0 0 6 0 6 6 0 6
1 3 3 5 5 3 3 1
Output #1
YES
InputCopy OutputCopy
Input #2
0 0 6 0 6 6 0 6
7 3 9 5 11 3 9 1
Output #2
NO
InputCopy OutputCopy
Input #3
6 0 6 6 0 6 0 0
7 4 4 7 7 10 10 7
Output #3
YES
InputCopy OutputCopy
题目信息
题号
993A
时间限制
1 s
内存限制
256 MB
标签
计算几何
模拟

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