Largest Triangle

시간 제한1초메모리 제한2048 MB

요약
x-단조 지형 다각형이 주어질 때, 지형의 한 점을 꼭짓점으로 가지면서 지형 안에 완전히 들어가는 가장 큰 삼각형을 찾는다.
난이도

보통10점 중 7점

유형
기하, 투 포인터, 분할 정복
정답자
아직 제출이 없습니다

문제

A “terrain” is an xx-monotone polygon defined by the points p_1,…,p_np\_1, \dots , p\_n where each point p_ip\_i has coordinates (x_i,y_i)(x\_i , y\_i), and the following three conditions hold:

  • y_1=y_n=0y\_1 = y\_n = 0
  • y_i>0y\_i > 0 for 1<i<n1 < i < n
  • x_i<x_i+1x\_i < x\_{i+1} for 1≤i<n1 \le i < n

Given a terrain defined by the points p_1,…,p_np\_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 p_2p\_2 through p_n−1p\_{n-1}.

입력

The first line of input contains an integer nn, representing the number of points in the terrain (3≤n≤1053 \le n \le 10^5). The iith line in the following nn lines consists of two space-separated integers x_ix\_i and y_iy\_i, representing the point p_ip\_i of the terrain (0≤x_i,y_i≤1090 \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 10−610^{-6}.

예제1

  1. 예제 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