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

建议使用的浏览器:

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

6976:Game on Plane

题目描述
Alice and Bob are playing a game. In this game, there are $n$ straight lines on the 2D plane. Alice will select exactly $k$ straight lines $l_1,l_2,\dots,l_k$ among all the $n$ straight lines first, then Bob will draw a straight line $L$. The penalty of Bob is defined as the number of lines in $\{l_1,l_2,\dots,l_k\}$ that shares at least one common point with $L$. Note that two overlapping lines also share common points.

Alice wants to maximize the penalty of Bob while Bob wants to minimize it. You will be given these $n$ lines, please write a program to predict the penalty of Bob for $k=1,2,3,\dots,n$ if both of the players play optimally.
输入解释
The first line contains a single integer $T$ ($1 \leq T \leq 500$), the number of test cases. For each test case:

The first line contains a single integer $n$ ($1 \leq n \leq 100\,000$), denoting the number of straight lines.

Each of the next $n$ lines contains four integers $xa_i,ya_i,xb_i$ and $yb_i$ ($0\leq xa_i,ya_i,xb_i,yb_i\leq 10^9)$, denoting a straight line passes both $(xa_i,ya_i)$ and $(xb_i,yb_i)$. $(xa_i,ya_i)$ will never be coincided with $(xb_i,yb_i)$.

It is guaranteed that the sum of all $n$ is at most $1\,000\,000$.
输出解释
For each test case, output $n$ lines, the $i$-th ($1\leq i\leq n$) of which containing an integer, denoting the penalty of Bob when $k=i$.
输入样例
2
2
1 1 2 2
0 0 2 3
3
1 1 2 2
1 1 2 2
3 2 5 4
输出样例
0
1
0
0
0

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6976

最后修改于 2021-10-23T19:10:53+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000/3000MS(Java/Others) 524288/524288K(Java/Others)