Rich with loot from the temple, you purchased a house and hired a team of workers to renovate it.
This team has a strange way of painting.
Instead of fully covering a wall with paint, like a normal crew, the
Constraints
Subtask 1 [10%]
Subtask 2 [25%]
Subtask 3 [65%]
No additional constraints.
Input Specification
The first line contains two integers,
The following
Output Specification
Output one line containing a single integer, the minimum area covered by paint.
Sample Input 1
3 0
1 1 3 3
2 2 4 4
5 1 7 7
Sample Output 1
19
Explanation for Sample 1
A total of
Sample Input 2
4 1
2 2 5 7
4 1 6 5
3 3 5 8
6 5 8 8
Sample Output 2
22
Explanation for Sample 2
It is optimal to tell the first or fourth painter not to paint their rectangle.
Comments