PivotOJ

Triangle

시간 제한: 1000ms메모리 제한: 2048MB출처: ICPC Asia Seoul Regional 2024BOJ 32840

문제

There is a triangle whose coordinates of three vertices AA, BB, and CC 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 (4,8)(4, 8), (8,1)(-8, -1), and (7,7)(7, -7), 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.

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 (x,y)(x, y)-coordinates of the three vertices A=(Ax,Ay)A = \left(A_x, A_y\right), B=(Bx,By)B = \left(B_x, B_y\right), and C=(Cx,Cy)C = \left(C_x, C_y\right) of a triangle, which AxA_x, AyA_y, BxB_x, ByB_y, CxC_x, and CyC_y are given in that order. Each value of the coordinates is an integer between 109-10^9 and 10910^9, inclusive.

출력

Your program is to write to standard output. Let the area of the newly created triangle with the largest area be S_\max, and the area of the triangle with the smallest area be S_\min. If such triangles can be found, print 2S_\max and 2S_\min in that order, where both 2S_\max and 2S_\min are positive integers. If such triangles cannot be found, print -1.

예제

예제 1

입력
4 8 -8 -1 7 -7
출력
69 46

예제 2

입력
-8 1 7 11 7 -5
출력
121 23

예제 3

입력
0 0 1 10 10 0
출력
-1
코드를 제출하려면 로그인하세요.