Logo
(追記) (追記ここまで)

32840번 - Triangle 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB25814812860.952%

문제

There is a triangle whose coordinates of three vertices $A,ドル $B,ドル and $C$ 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),ドル $(-8, -1),ドル and $(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)$-coordinates of the three vertices $A = \left(A_x, A_y\right),ドル $B = \left(B_x, B_y\right),ドル and $C = \left(C_x, C_y\right)$ of a triangle, which $A_x,ドル $A_y,ドル $B_x,ドル $B_y,ドル $C_x,ドル and $C_y$ are given in that order. Each value of the coordinates is an integer between $-10^9$ and 10ドル^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 2ドルS_\max$ and 2ドルS_\min$ in that order, where both 2ドルS_\max$ and 2ドルS_\min$ are positive integers. If such triangles cannot be found, print -1.

제한

예제 입력 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

힌트

출처

ICPC > Regionals > Asia Pacific > Korea > 2024 ICPC Asia Seoul Regional L번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /