The problem statement
A rectangle is called rectilinear if its edges are all parallel to coordinate axes. Such a rectangle can be described by specifying the coordinates of its lower-left and upper-right corners.
Write a function:
int area_of_sum(int K, int L, int M, int N, int P, int Q, int R, int S); that, given eight integers representing two rectilinear rectangles (one with lower-left corner (K, L) and upper-right corner (M, N), and another with lower-left corner (P, Q) and upper-right corner (R, S)), returns the area of the sum of the rectangles. If the rectangles intersect, the area of their intersection should be counted only once. The function should return -1 if the area of the sum exceeds 2,147,483,647. read more