77. Overlapping Planetary Areas

Time Limit: 1 seconds

Memory Limit: 1024 MB

Rating: 1300

Problem Statement

You are given a list of rectangular areas on a flat plane, which represents a 2D view of space and different areas in space. Find the area of which the most squares overlap. Find how many squares overlap, and give its area as an integer.

Input

A list of integers, each separated by a space. Each 4 integers represent the $x$-coordinate of the top leftmost point, the y coordinate of the top leftmost point, width, and height of a square. e.g.: 1 2 3 4 5 6 7 8 can be represented as a rectangle with the top left edge at coordinate $(1, 2)$, with a width of 3 and height of 4 4 ≤ len(str) ≤ $4 \cdot 10^3$ for each integer $n$ in the string, $1 ≤ n ≤ 10^3$

Output

Line 1: The maximum number of squares that overlap at any given point Line 2: The exact area of which the most squares overlap

Sample Cases
Sample Input 0:
1 1 1 1 1 1 2 2

Sample Output 0:
2
1
Explanation

Not available for this problem.

Sources

KL Coding Cup October 2024 > Problem 15

Submit | Back