首页 > ACM题库 > HDU-杭电 > hdu 4785 Exhausted Robot待解决[解题报告]C++
2015
09-18

hdu 4785 Exhausted Robot待解决[解题报告]C++

Exhausted Robot

问题描述 :

  You want a tidy palace but you are too lazy to do the cleaning. As a result, your cousin Coach Pang gave you a cleaning robot. Unfortunately, the robot has some flaws and some furniture may hamper the cleaning.
  To simplify the problem, we consider all objects in a 2D-Plane. The room is viewed as a rectangle with edges parallel to the axis. Both robot and furniture are in shape of convex polygons.
  During the cleaning, the robot can move towards any direction (but only translation are permitted which means it cannot rotate). Although the robot has the ability to move through furniture, it can only do cleaning when it has no area outside the room or intersect with furniture. Besides, only one point can do the cleaning which is given as the first vertex of the robot in the input.

输入:

  The first line of the input contains an integer T indicates the number of test cases.
  In the first line of each test case, there will be an integer n (0 <= n <= 20) and then (n + 1) blocks of data describing the objects. The first n blocks for furniture and the last one for the robot. All the vertices of an object are shown in corresponding block with counter-clockwise order. The first line of each block contains an integer m (3 <= m <= 20). Then m lines follow. In each line, there are two integers xi, yi indicating a vertex of the convex polygon.
��At the end of each set of data, there will be four integers in a line, xBL, yBL, xTR, yTR, indicates the coordinates of the bottom left corner and the top right corner of your room.
��The absolute value of all coordinates are within 103.

输出:

  The first line of the input contains an integer T indicates the number of test cases.
  In the first line of each test case, there will be an integer n (0 <= n <= 20) and then (n + 1) blocks of data describing the objects. The first n blocks for furniture and the last one for the robot. All the vertices of an object are shown in corresponding block with counter-clockwise order. The first line of each block contains an integer m (3 <= m <= 20). Then m lines follow. In each line, there are two integers xi, yi indicating a vertex of the convex polygon.
��At the end of each set of data, there will be four integers in a line, xBL, yBL, xTR, yTR, indicates the coordinates of the bottom left corner and the top right corner of your room.
��The absolute value of all coordinates are within 103.

样例输入:

2
1
4
3 3
4 3
4 4
3 4
4
1 1
2 1
2 2
1 2
0 0 10 10
0
4
1 1
2 1
2 2
1 2
0 0 10 10

样例输出:

Case #1: 77.000
Case #2: 81.000