编程介的小学生 2020-01-03 19:58 采纳率: 20.5%
浏览 109

Fireworks 烟火的问题

Problem Description
2008 witnessed the magnificent opening ceremony of the 29th Beijing Olympic Games. The gorgeous fireworks shows during the ceremony have left deep impressions on millions of people all over the world.

Fireworks are always used to accompany many festivities. Today, in important events and festivities, fireworks are still guaranteed sights.

Recently, a new advanced device for generating fireworks is put into use. This device can precisely control the shapes and the positions and the colors of fireworks easily and arbitrarily. To use this device, we just need to set up its range of targets, as well as the appearances of fireworks. However, this kind of devices have a fatal flaw - if two or more devices have common part(s) in their ranges of targets, even just a point, it may cause some unpredictable errors, and finally result in unexpected appearances.

Now here comes your task: given the target ranges of two devices, please determine whether they have common part(s).

Note that the target range of a device will always be a none hole and none self-intersecting polygon on a plane, and the edges are considered as a part of the range. To simplify the problem, it’s guaranteed that interior angles of polygon will never be straight angles.

Input
The input contains multiple test cases, and the number of test cases is less than 50.
Each test case begins with two integers, m and n (3 <= m, n <= 500), indicating the numbers of the vertices of the ranges of two devices. Then m + n lines follow. Each line contains three float numbers (no more than 1000 in absolute value) indicating the coordinates of a point in 3D space. The first m points are the vertices of the range of the first device, and the other n points are the vertices of the range of the second device. The vertices of both polygonal ranges are given in clockwise order.

Two consecutive cases are separated by a blank line.

The input ends with m = 0 and n = 0

Output
For each test case, there should be a single line containing only one word "YES" or "NO" as the answer to the question: Are the ranges of two devices have common part(s)?

Sample Input
4 3
3 3 0
7 8 0
8 7 0
10 0 0
5 3 -1
3 2 9
1 8 7

4 3
3 3 0
7 8 0
8 7 0
10 0 0
5 5 1
3 2 9
1 8 7

0 0

Sample Output
YES
NO

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 mmocr的训练错误,结果全为0
    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀