当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3416:Crossing

题目描述

Wintokk has collected a huge amount of coins at THU. One day he had all his coins fallen on to the ground. Unfortunately, WangDong came by and decided to rob Wintokk of the coins.

They agreed to distribute the coins according to the following rules:

Consider the ground as a plane. Wintokk draws a horizontal line on the plane and then WangDong draws a vertical one so that the plane is divided into 4 parts, as shown below.

Wintokk will save the coins in I and III while those fit in II and IV will be taken away by the robber WangDong.

For fixed locations of the coins owned by Wintokk, they drew several pairs of lines. For each pair, Wintokk wants to know the difference between the number of the saved coins and that of the lost coins.

It's guaranteed that all the coins will lie on neither of the lines drew by that two guys.

输入解释

The first line contains an integer T, indicating the number of test cases. Then T blocks of test cases follow. For each case, the first line contains two integers N and M, where N is the number of coins on the ground and M indicates how many times they are going to draw the lines. The 2nd to (N+1)-th lines contain the co-ordinates of the coins and the last M lines consist of the M pairs integers (x, y) which means that the two splitting lines intersect at point (x, y).

(N,M ≤ 50000, 0 ≤x,y ≤ 500000)

输出解释

For each query, output a non-negative integer, the difference described above. Output a blank line between cases.

输入样例
2
10 3
29 22
17 14
18 23
3 15
6 28
30 27
4 1
26 7
8 0
11 21
2 25
5 10
19 24
10 5
28 18
2 29
6 5
13 12
20 27
15 26
11 9
23 25
10 0
22 24
16 30
14 3
17 21
8 1
7 4
输出样例
6
4
4

2
2
4
4
4

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3416

最后修改于 2020-10-29T07:01:02+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000 65536