Croc Champ 2013 - Round 2
D
Ksusha and Square
Codeforces
2700
原题
← CE →
翻译中…

Ksusha is a vigorous mathematician. She is keen on absolutely incredible mathematical riddles.

翻译中…

Today Ksusha came across a convex polygon of non-zero area. She is now wondering: if she chooses a pair of distinct points uniformly among all integer points (points with integer coordinates) inside or on the border of the polygon and then draws a square with two opposite vertices lying in the chosen points, what will the expectation of this square's area be?

翻译中…

A pair of distinct points is chosen uniformly among all pairs of distinct points, located inside or on the border of the polygon. Pairs of points $*p*, *q*$ $(*p* ≠ *q*)$ and $*q*, *p*$ are considered the same.

翻译中…

Help Ksusha! Count the required expectation.

翻译中…

Input

翻译中…

The first line contains integer $*n*$ $(3 ≤ *n* ≤ 10^{5})$ — the number of vertices of Ksusha's convex polygon. Next $*n*$ lines contain the coordinates of the polygon vertices in clockwise or counterclockwise order. The $*i*$-th line contains integers $*x*_{*i*}, *y*_{*i*}$ $(|*x*_{*i*}|, |*y*_{*i*}| ≤ 10^{6})$ — the coordinates of the vertex that goes $*i*$-th in that order.

翻译中…

Output

翻译中…

Print a single real number — the required expected area.

翻译中…

The answer will be considered correct if its absolute and relative error doesn't exceed $10^{ - 6}$.

翻译中…

样例

Input #1
3
0 0
5 5
5 0
Output #1
4.6666666667
InputCopy OutputCopy
Input #2
4
-1 3
4 5
6 2
3 -5
Output #2
8.1583333333
InputCopy OutputCopy
Input #3
3
17 136
859 937
16 641
Output #3
66811.3704155169
InputCopy OutputCopy
题目信息
题号
293D
时间限制
4 s
内存限制
256 MB
标签
计算几何
数学
概率论
双指针

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