Rectangles intersection
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Two rectangles are given by the integer coordinates of a pair of diagonal vertices in a rectangular coordinate system, and their sides are guaranteed to be parallel to the axes. Find the area of the common part of rectangles.
Input
Four pairs of integers (each is less than 10^6
by absolute value).
Output
Print the area of the common part of rectangles.
Examples
Input #1
Answer #1
Submissions 498
Acceptance rate 26%