Codey and Rectangles 2
https://www.hackerrank.com/contests/codenection-2024-final-round-closed-category/challenges/cn24-19
Question
Codey is playing with rectangles again, but this time it's even more fun! Codey decorates the floor with n rectangular sheets of paper. Each side of the sheets is parallel to the x-axis or y-axis.
Each sheet's position on the floor is defined by four integers:
and : The x-coordinates of the left and right edges of the sheet.
and : The y-coordinates of the bottom and top edges of the sheet.
Help Codey calculate the total area covered by the rectangular sheets of paper on the floor.
Input Format
The first line contains an integer n, where n represents the number of rectangular sheet of paper Codey has.
The following n lines contain four integers and , where and represent the left and right edges of the sheet on the x-axis, while and represent the bottom and top edges of the sheet on the y-axis.
Constraints
Output Format
Output an integer, the total area covered by the sheets of paper.
Sample Inputs:
Last updated