QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 128 MB Total points: 100

#11162. 毯子

Statistics

今年夏天,Byteburg 的市民们成群结队地来到 Byteotian 湖畔的城市沙滩,享受日光浴的乐趣。每位 Byteburg 市民都带着 Byteasar & Son 公司生产的毯子,这是本季最流行的款式。所有毯子的大小均为 $a \times b$(尽管图案各异),且每位日光浴者铺设毯子时,其长边总是垂直于湖岸。

Byteoni 教授也是今年日光浴者中的一员。经过几天的观察,教授注意到,所有来到沙滩的人总是把毯子铺在自己最喜欢的固定位置,且位置从不改变。尽管人们到达和离开沙滩的时间不同,但教授从未听说有哪位日光浴者会通过铺设毯子来占用他人的固定位置。这一观察结果让教授感到非常好奇,于是他决定研究这一现象。

为此,他在沙滩上建立了一个坐标系,并记录了每位 Byteburg 市民铺设毯子时左下角的坐标。该坐标系的设定方式使得 OX 轴平行于毯子的 $a$ 边,OY 轴平行于毯子的 $b$ 边。教授最初想计算每对毯子所占区域的交集面积。但他后来意识到,对于后续研究而言,只需得到这些值的平均数就足够了。换句话说,他感兴趣的是任意两名不同的 Byteburg 市民所铺设毯子区域的交集面积的期望值。请利用教授提供的数据,帮助他完成计算。

输入格式

输入的第一行包含三个整数 $n, a, b$($2 \le n \le 200\,000$,$1 \le a, b \le 1\,000\,000$),分别表示 Byteburg 的居民人数以及毯子的尺寸。接下来的 $n$ 行,每行包含两个整数 $x_i$ 和 $y_i$($0 \le x_i, y_i \le 1\,000\,000$),表示第 $i$ 位 Byteburg 市民铺设毯子时左下角的坐标。

输出格式

程序应输出一个实数,表示任意两名 Byteburg 市民所铺设毯子区域的交集面积的平均值。如果你的结果在 $[x - \epsilon, x + \epsilon]$ 范围内(其中 $x$ 为正确答案,$\epsilon = 10^{-2}$),则该结果被视为有效。

样例

输入 1

4 3 5
0 0
2 1
3 3
0 5

输出 1

1.833333333

说明 1

精确结果为:$\frac{4+0+0+1+6+0}{6} = 1\frac{5}{6}$。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.