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

建议使用的浏览器:

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

7209:Bowling

题目描述
Little Rabbit has recently become interested in a special kind of bowling. The bowling ball can be seen as a convex polygon on a two-dimensional plane. And the pins (the target of the bowling ball) can be seen as points on the plane.

As with regular bowling, the goal is to make the bowling ball hit as many pins as possible. We can suppose that the bowling ball makes a translational motion on the plane. Once the pin touches the bowling ball (including the boundary), the pin will be knocked down and will not affect the direction of the bowling ball's motion.

Now given the position of the bowling ball and the pins, for different directions of the bowling ball's motion, please calculate how many pins it can knock down.
输入解释
The first line of the input contains an integer $T$ ($1 \le T \le 100$), indicating the number of test cases.

For each test case, the first line contains an integer $n$ ($3 \le n \le 10^5$), indicating the number of vertices of the convex polygon.

Each of the next $n$ lines contains two integers $x,y$ ($|x|,|y|\le 10^9$), indicating that the coordinates of a vertex of the convex polygon are $(x,y)$. The vertices are given in counterclockwise order, and there are no three vertices collinear.

The next line contains an integer $m$ ($1 \le m \le 10^5$), indicating the number of pins.

Each of the next $m$ lines contains two integers $x,y$ ($|x|,|y|\le 10^9$), indicating that the coordinates of a pin are $(x,y)$. It is guaranteed that the pins are located strictly at the outside of the polygon.

The next line contains an integer $q$ ($1 \le q \le 10^5$), indicating the number of queries.

Each of the next $q$ lines contains two integers $x,y$ ($|x|,|y|\le 10^9$), indicating that the direction vector of the bowling ball's motion is $(x,y)$. It's guaranteed that $(x,y)\neq (0,0)$.

It is guaranteed that $\sum n$, $\sum m$, and $\sum q$ over all test cases do not exceed $2\times10^5$.
输出解释
For each query, output an integer in a single line indicating the number of pins the bowling ball can knock down.
输入样例
1
4
0 0
2 0
2 2
0 2
5
1 4
3 1
4 2
5 1
3 3
3
0 1
1 0
1 1
输出样例
1
3
3

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

源链接: HDU-7209

最后修改于 2022-09-15T06:17:25+00:00 由爬虫自动更新

共提交 0

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