CF629D Babaei and Birthday Cake

题目描述

Babaei 打算制作一个特殊的蛋糕。蛋糕由一些已知半径和高度的圆柱体组成,蛋糕的体积等于相应圆柱体的体积之和。 但是,还有一些额外的烹饪限制。编号为 $i$ 的蛋糕只能放在桌子上或编号为 $j$ 的蛋糕上,其中 $j\lt i$。 此外,为了给朋友们留下深刻印象,只有当蛋糕 $i$ 的体积超过蛋糕 $j$ 的体积时,Babaei 才会把蛋糕 $i$ 放在蛋糕 $j$ 上面。 Babaei 想要准备一个总体积最大的生日蛋糕,请你帮助他找到这个最大体积。

输入格式

输入的第一行包含一个整数 $n$($1\le n\le10^5$),代表 Babaei 的蛋糕数量。 接下来 $n$ 行,每行两个整数 $r_i,h_i$($1\le r_i,h_i\le10^4$),代表第 $i$ 个蛋糕的半径和高度。

输出格式

输出 Babaei 可以制作的蛋糕的最大体积。如果误差不超过 $10^{-6}$,则该答案将被视为正确。即:输出为 $a$,标准答案为 $b$,若 $\dfrac{\vert a-b\vert}{\max\left(1,b\right)}\le10^{-6}$,判为答案正确。

说明/提示

In first sample, the optimal way is to choose the cake number $ 1 $ . In second sample, the way to get the maximum volume is to use cakes with indices $ 1 $ , $ 2 $ and $ 4 $ .