Largest Triangle | 프로그래밍의 벗 PivotOJ
PivotOJ

Largest Triangle

시간 제한: 1000ms메모리 제한: 2048MB출처: ICPC Asia Tehran Regional Contest 2023BOJ 33182
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

A “terrain” is an xx-monotone polygon defined by the points p1,,pnp_1, \dots , p_n where each point pip_i has coordinates (xi,yi)(x_i , y_i), and the following three conditions hold:

  • y1=yn=0y_1 = y_n = 0
  • yi>0y_i > 0 for 1<i<n1 < i < n
  • xi<xi+1x_i < x_{i+1} for 1i<n1 \le i < n

Given a terrain defined by the points p1,,pnp_1, \dots , p_n, find the largest triangle that fits entirely within the terrain, and one of its three vertices is positioned at one of the terrain points p2p_2 through pn1p_{n-1}.

[이미지 1]

입력

The first line of input contains an integer nn, representing the number of points in the terrain (3n1053 \le n \le 10^5). The iith line in the following nn lines consists of two space-separated integers xix_i and yiy_i, representing the point pip_i of the terrain (0xi,yi1090 \le x_i , y_i \le 10^9).

출력

Print the area of the largest triangle contained within the terrain. Your output will be considered correct if its absolute or relative error is at most 10610^{-6}.

예제

예제 1

입력
11
0 0
2 10
4 5
6 7
8 8
10 4
12 6
14 4
15 4
16 7
17 0
출력
53.666667
코드를 제출하려면 로그인하세요.