Rectangles
Hard
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
For the given N rectangles, your task is to find the smallest area that can be covered by these rectangles, allowing them to overlap. Each rectangle is defined by the lengths of its two sides.
Input
The first line contains the integer N, representing the number of rectangles. This is followed by N lines, each containing two integers that specify the lengths of the sides of a rectangle (1 ≤ N ≤ 2·10^5, and the lengths of the sides do not exceed 10^9).
Output
Output a single line containing the smallest possible area that can be covered by the rectangles.
Examples
Input #1
Answer #1
Submissions 118
Acceptance rate 8%