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

建议使用的浏览器:

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

3684:Gunshots

题目描述
President Bartlet was shot! A group of terrorists shot to the crowd when President Bartlet waved to cheering people after his address. Many people were shot by the irrational bullets. Senior FBI agent Don Epps takes responsibility for this case. According to a series of crime scene investigation, including analyzing shot shells, replaying video from closed-circle television and collecting testimony by witnesses, Don keeps all the information about where and how the terrorists shot to crowd, as well as the location of every single person when the gun shoot happened. Now he wants to know how many gunshot victims are there in this case.

Imagine that each target person can be regarded as a polygon (can be concave or self-intersecting) and each gunshot can be regarded as a half-line. The bullet will be stopped by the first person it shoots. A person can be shot in three ways:

To simplify the problem, we assume that any two polygons can be completely separated by a line. Also each start point of the gunshot can be separated from each polygon by a line. Now given M people and N gunshots, please work out which person has been shot by each bullet.
输入解释
There are multiple test cases in the input. The first line of the input file is an integer T demonstrating the number of test cases. (T<=10).

For each test case, the first line is an integer N, representing the number of people (polygons). Following lines demonstrates the polygons. For the ith polygon (0<=i<N), the first line is an integer Qi, representing the number of edges of this polygon. In each of the following Qi lines, there are two real numbers xi and yi representing a point. Every pair of adjacent points demonstrate an edge of this polygon (i.e. (xi, yi) to (xi+1, yi+1) is an edge, in which 0<=i<Qi-1), and (xQi-1, yQi-1) to (x0, y0) also demonstrates an edge of this polygon.

Then there is a line contains an integer M representing the number of gunshots. In the following M lines, each line contains four real numbers x, y, dx and dy, representing the start point (x, y) and direction vector (dx, dy) of that gunshot.

In all test cases, we assume that 0< N<=100, 0<Qi<=1000, 0<M<=10000.
输出解释
For each test case, output contains M lines and the ith line demonstrates the result of the ith gunshot.

If the ith gunshot shoots the jth polygon, the ith line contains “HIT j”, otherwise it contains a word “MISS” (means that it does not shoot any target). The polygons are numbered in the order of their appearance in the input file, and the numbers start from 0.

At the end of each test case, please output a single line with “*****”.
输入样例
1
1
4
0 0
1 1
0 1
1 0
2
-1 0 1 0
-2 0 -1 0
输出样例
HIT 0
MISS
*****

提示
The figure of the first case in the samples is as follows:
来自杭电HDUOJ的附加信息
Recommend lcy&zhengfeng

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

源链接: HDU-3684

最后修改于 2020-10-25T23:05:58+00:00 由爬虫自动更新

共提交 0

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