#P14776. [ICPC 2024 Seoul R] Triangle
[ICPC 2024 Seoul R] Triangle
题目描述
There is a triangle whose coordinates of three vertices and are all integers. If you select a point on each side of the triangle whose coordinates are integers and connect those points, a new triangle is created. When creating a new triangle, no vertex of the given triangle can be selected as a vertex of the new triangle.
Depending on which points you select and connect, the area of the newly created triangle may be large or small.
You are to write a program that finds out the largest and smallest areas of the newly created triangle if they exist.
For example, as shown in the figure below, if the coordinates of the three vertices of the given triangle are , , and , the yellow triangle shown in Fig. L.1(a) has the largest area among those that satisfy the condition, and the blue triangle shown in Fig. L.1(b) has the smallest area.
:::align{center}
:::
There may not be a point on any side of the given triangle whose coordinates are integers, in which case the triangle you are looking for does not exist.
It is guaranteed that the three points of the given input are not on a straight line.
输入格式
Your program is to read from standard input. The input consists of a line containing six integers that are the -coordinates of the three vertices , , and of a triangle, which , , , , , and are given in that order. Each value of the coordinates is an integer between and , inclusive.
输出格式
Your program is to write to standard output. Let the area of the newly created triangle with the largest area be , and the area of the triangle with the smallest area be . If such triangles can be found, print and in that order, where both and are positive integers. If such triangles cannot be found, print .
4 8 -8 -1 7 -7
69 46
-8 1 7 11 7 -5
121 23
0 0 1 10 10 0
-1