QOJ.ac

QOJ

حد الوقت: 2.0 s حد الذاكرة: 256 MB مجموع النقاط: 100 قابلة للهجوم ✓

#16743. 自备炸弹

الإحصائيات

一个破坏排完成了任务,并在敌方领土上安置了一些炸弹。现在他们准备向指挥官报告将有多少敌军单位被消灭。他们把这个任务交给了你。

敌方领土由一个网格表示,敌军排位于其中。敌军单位站在由矩形表示的排中,且这些矩形互不相交。每个网格最多包含一个敌军单位。炸弹具有强大的威力,可以消灭与炸弹在同一网格线(行或列)上的所有敌军单位:要么是水平方向,要么是垂直方向,但不能同时是两者。不幸的是,所有炸弹都是由没有经验的工程师手工制作的,因此很难说它们会如何爆炸,或者是否会爆炸。对于每个炸弹,只有两个值是确定的:$p_1$,炸弹水平爆炸的概率;$p_2$,炸弹垂直爆炸的概率。隐式地可知,炸弹完全不爆炸的概率为 $100\% - p_1 - p_2$。

破坏排只在敌军排的外部安置炸弹。给定敌方领土和安置炸弹的描述,你需要计算被消灭的敌军单位数量的期望值。

输入格式

第一行包含两个整数 $N$ 和 $M$:分别表示敌军排的数量和炸弹的数量($1 \le N, M \le 10^5$)。

接下来的 $N$ 行输入包含敌军排的描述,每行一个。每个排由四个整数 $x_1, y_1, x_2, y_2$ 描述:矩形对角网格的坐标($x_1 \le x_2, y_1 \le y_2$)。

接下来的 $M$ 行输入包含炸弹的描述,每行一个。每个炸弹由整数 $x, y$ 和数字 $p_1, p_2$ 描述:安置炸弹的网格坐标以及以非负整数百分比表示的炸弹质量特征($p_1 + p_2 \le 100$)。

所有坐标的绝对值不超过 $10^9$。

输出格式

输出必须包含一个实数:问题的答案,绝对或相对误差不超过 $10^{-9}$。

样例

输入样例 1

1 1
-1 -1 1 1
0 3 33 33

输出样例 1

0.990000000000000

输入样例 2

1 2
1 1 5 5
0 2 100 0
2 0 0 100

输出样例 2

9.000000000000000

输入样例 3

2 2
0 3 2 5
3 0 5 2
1 1 30 60
4 4 50 40

输出样例 3

4.980000000000000

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.