#6970. [ICPC 2023 Tehran R] Largest Triangle

[ICPC 2023 Tehran R] Largest Triangle

[ICPC 2023 Tehran R] Largest Triangle

题目描述

A "terrain" is an $x$-monotone polygon defined by the points $p_1, \ldots, p_n$ where each point $p_i$ has coordinates $(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 1≤i<n1 \leq i < n

Given a terrain defined by the points p1,…,pnp_1, \ldots, 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 pn−1p_{n-1}.

:::align{center} :::

输入格式

The first line of input contains an integer $n$, representing the number of points in the terrain ($3 \leq n \leq 10^5$). The $i^{th}$ line in the following $n$ lines consists of two space-separated integers $x_i$ and $y_i$, representing the point $p_i$ of the terrain ($0 \leq x_i, y_i \leq 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^{-6}$.
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

提示

(暂无提示) 标签: P14707|计算几何|2023|Special Judge|凸包|ICPC

来源

P14707|[ICPC 2023 Tehran R] Largest Triangle