A building company needs to create a software to analyze a bidimensional plane, that contains the top view of a construction.
Every building that is constructed at the bottom has a height of , and the company allows to build one, two, more or no buildings above one building, such that the height of these buildings will increase by , and the horizontal and vertical coordinates of these buildings will always fit in the coordinates of the building that is down, so the area will also be smaller.
This file and this file contain the following: in the first line there is a number that represents the number of buildings, then there are lines that represent the coordinates of every building with the following structure:
Where is the upper left coordinate of the building, and is the lower right coordinate of the building, and .
Your program must compute the total volume for the input given. If the volume for the first file is and the volume for the second file is , give your answer as .
For example, consider the following input:
The plane would be the following (note that the coordinates can be given in any order):
Then, the area for the buildings will be:
Now, and are above and is above , so the height of and is , and the height of is ; and is above , so the height of is and, of course, the height of is . So, the volume would be:
.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
No explanations have been posted yet. Check back later!