F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Exhausted Robot

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 459    Accepted Submission(s): 93


Problem Description
¡¡¡¡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.
 

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.
 

Output
¡¡¡¡For each test case, output one line ¡°Case #x: y¡±, where x is the case number (starting from 1) and y is size of the area that robot can clean, rounded to 3 digits after decimal point.
 

Sample Input
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
 

Sample Output
Case #1: 77.000 Case #2: 81.000
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-26 04:21:17, Gzip enabled