Codeforces Round 343 (Div. 2)
D
Babaei and Birthday Cake
Codeforces
2000
原题
← CE →
翻译中…

As you know, every birthday party has a cake! This time, Babaei is going to prepare the very special birthday party's cake.

翻译中…

Simple cake is a cylinder of some radius and height. The volume of the simple cake is equal to the volume of corresponding cylinder. Babaei has $*n*$ simple cakes and he is going to make a special cake placing some cylinders on each other.

翻译中…

However, there are some additional culinary restrictions. The cakes are numbered in such a way that the cake number $*i*$ can be placed only on the table or on some cake number $*j*$ where $*j* < *i*$. Moreover, in order to impress friends Babaei will put the cake $*i*$ on top of the cake $*j*$ only if the volume of the cake $*i*$ is strictly greater than the volume of the cake $*j*$.

翻译中…

Babaei wants to prepare a birthday cake that has a maximum possible total volume. Help him find this value.

翻译中…

Input

翻译中…

The first line of the input contains a single integer $*n*$ ($1 ≤ *n* ≤ 100 000)$ — the number of simple cakes Babaei has.

翻译中…

Each of the following $*n*$ lines contains two integers $*r*_{*i*}$ and $*h*_{*i*}$ ($1 ≤ *r*_{*i*}, *h*_{*i*} ≤ 10 000$), giving the radius and height of the $*i*$-th cake.

翻译中…

Output

翻译中…

Print the maximum volume of the cake that Babaei can make. Your answer will be considered correct if its absolute or relative error does not exceed $10^{ - 6}$.

翻译中…

Namely: let's assume that your answer is $*a*$, and the answer of the jury is $*b*$. The checker program will consider your answer correct, if image.

翻译中…

Note

翻译中…

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$.

翻译中…

样例

Input #1
2
100 30
40 10
Output #1
942477.796077000
InputCopy OutputCopy
Input #2
4
1 1
9 7
1 4
10 7
Output #2
3983.539484752
InputCopy OutputCopy
题目信息
题号
629D
时间限制
2 s
内存限制
256 MB
标签
数据结构
动态规划

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。