The company that you work for is moving to a larger building. The new office is rectangular and will be subdivided into cubicles.
View the step-by-step solution to:

Question

# The company that you work for is moving to a larger building. The new office is rectangular and will be subdivided

into cubicles. Your employees want to request particular positions for their cubicles. You want to set up a system that lets them make their requests.

You have expressed the new office space as a coordinate system where each unit is one foot. The south-west corner of this space is assigned the coordinate (0, 0). The positive X axis is aligned with the inner edge of the building's south wall. The positive Y axis is aligned with the west wall. Employees request a position for their cubicle by giving the coordinates of the cubicle's south-west corner and the cubicle's north-east corner.

Input: Input consists of up to 10 test cases. Each case starts with a line containing a pair of integers w and h giving the size of the new office space (w is the number of feet west-to-east, h is the number of feet south-to-north). Both of these numbers are in the range 1 to 100.

After this is a line containing an integer n between 1 and 20 inclusive, giving the number of employees you have. Following this are n cubicle placement requests, one per line.

Each request starts with the name of the employee. The name is a string of 1 to 20 characters (mix of upper and lower case letters a-z, no spaces). The name is followed by four integers x1, y1, x2, y2 where (x1, y1) indicate the coordinates of the south-west corner of the desired cubicle and (x2, y2) indicate the coordinates of the north-east corner. Each set of request coordinates satisfies 0 ≤ x1 ≤ x2 ≤ w and 0 ≤ y1 ≤ y2 ≤ h. The sequence of test cases ends at the end of file.

Output: For each test case, print out a report that starts with the total number of square feet in the building and the number of square feet that no employee has requested (the unallocated space).

Next, make the total number of square feet that are contested because more than one employee has requested the same region of the floor.

Finally, for each employee give the number of square feet that that employee can be guaranteed to have. This is the total area that they requested minus any regions that were requested by another employee.

List the employees in the same order they were given in the input. Leave a blank line after the output for each test case.

The input file will be called office.txt. It will have the following format:

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

### -

Educational Resources
• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents