logo AlgoBeat OnlineJudge
登录 注册

#214871. [ICPC 2024 Seoul R] Triangle

内存限制:2048 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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 .

样例

样例输入 1

4 8 -8 -1 7 -7

样例输出 1

69 46

样例输入 2

-8 1 7 11 7 -5

样例输出 2

121 23

样例输入 3

0 0 1 10 10 0

样例输出 3

-1