309978: CF1767A. Cut the Triangle

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Cut the Triangle

题意翻译

给定二维平面内一个面积不为零的三角形的三个顶点坐标 $(x_1,y_1),(x_2,y_2),(x_3,y_3)$。 你要判断是否能画一条水平或竖直的线,把这个三角形划分为两个面积不为零的三角形。

题目描述

You are given a non-degenerate triangle (a non-degenerate triangle is a triangle with positive area). The vertices of the triangle have coordinates $ (x_1, y_1) $ , $ (x_2, y_2) $ and $ (x_3, y_3) $ . You want to draw a straight line to cut the triangle into two non-degenerate triangles. Furthermore, the line you draw should be either horizontal or vertical. Can you draw the line to meet all the constraints? Here are some suitable ways to draw the line: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1767A/eae3d7282c3158bdbed223cdc7230dcfb540b234.png)However, these ways to draw the line are not suitable (the first line cuts the triangle into a triangle and a quadrangle; the second line doesn't cut the triangle at all; the third line is neither horizontal nor vertical): ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1767A/bffea37399e8b2b37904bb00d4f9d390b630614c.png)

输入输出格式

输入格式


The first line contains one integer $ t $ ( $ 1 \le t \le 10^4 $ ) — the number of test cases. Each test case consists of four lines. The first of them is empty. The $ i $ -th of the next three lines contains two integers $ x_i $ and $ y_i $ ( $ 1 \le x_i, y_i \le 10^8 $ ) — the coordinates of the $ i $ -th vertex of the triangle. Additional constraint on the input: in each test case, the triangle formed by three vertices has positive area (i. e. it is non-degenerate).

输出格式


For each test case, print YES if it is possible to cut the triangle according to the statement, or NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer).

输入输出样例

输入样例 #1

4


4 7
6 8
3 5


4 5
4 7
6 8


5 8
1 8
2 5


3 6
6 6
6 3

输出样例 #1

YES
YES
YES
NO

Input

题意翻译

给定二维平面内一个面积不为零的三角形的三个顶点坐标 $(x_1,y_1),(x_2,y_2),(x_3,y_3)$。 你要判断是否能画一条水平或竖直的线,把这个三角形划分为两个面积不为零的三角形。

Output

题目大意:
给定二维平面内一个面积不为零的三角形的三个顶点坐标 $(x_1,y_1),(x_2,y_2),(x_3,y_3)$。需要判断是否能画一条水平或竖直的线,把这个三角形划分为两个面积不为零的三角形。

输入输出数据格式:
输入格式:
第一行包含一个整数 $ t $($ 1 \le t \le 10^4 $)——测试用例的数量。
每个测试用例由四行组成。第一行是空的。接下来的三行每行包含两个整数 $ x_i $ 和 $ y_i $($ 1 \le x_i, y_i \le 10^8 $)——三角形的第 $ i $ 个顶点的坐标。
输入的额外限制:在每个测试用例中,由三个顶点形成的三角形都有正面积(即非退化三角形)。

输出格式:
对于每个测试用例,如果可以根据题目描述切割三角形,则打印 YES,否则打印 NO。每个字母的大小写都是可以接受的(YES, yes, Yes 都将被识别为肯定答案,NO, no, nO 都将被识别为否定答案)。题目大意: 给定二维平面内一个面积不为零的三角形的三个顶点坐标 $(x_1,y_1),(x_2,y_2),(x_3,y_3)$。需要判断是否能画一条水平或竖直的线,把这个三角形划分为两个面积不为零的三角形。 输入输出数据格式: 输入格式: 第一行包含一个整数 $ t $($ 1 \le t \le 10^4 $)——测试用例的数量。 每个测试用例由四行组成。第一行是空的。接下来的三行每行包含两个整数 $ x_i $ 和 $ y_i $($ 1 \le x_i, y_i \le 10^8 $)——三角形的第 $ i $ 个顶点的坐标。 输入的额外限制:在每个测试用例中,由三个顶点形成的三角形都有正面积(即非退化三角形)。 输出格式: 对于每个测试用例,如果可以根据题目描述切割三角形,则打印 YES,否则打印 NO。每个字母的大小写都是可以接受的(YES, yes, Yes 都将被识别为肯定答案,NO, no, nO 都将被识别为否定答案)。

加入题单

算法标签: