Painting the Barn (Gold)

200x200 격자에 주어진 N개의 축에 평행한 직사각형 위에 서로 겹치지 않는 직사각형을 최대 두 개까지 추가로 칠해, 정확히 K겹으로 덮이는 넓이의 최댓값을 구한다.

어려움8누적 합배열동적 계획법행렬아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Farmer John is not good at multitasking. He gets distracted often, making it hard to complete long projects. Currently, he is trying to paint one side of his barn, but he keeps painting small rectangular areas and then getting sidetracked by the needs of tending to his cows, leaving some parts of the barn painted with more coats of paint than others.

We can describe the side of the barn as a 2D xx-yy plane, on which Farmer John paints NN rectangles, each with sides parallel to the coordinate axes, each described by the coordinates of its lower-left and upper-right corner points.

Farmer John wants to apply several coats of paint to the barn so it doesn't need to be repainted again in the immediate future. However, he doesn't want to waste time applying an excessive number of coats of paint. It turns out that KK coats of paint is the optimal amount. However, looking at the amount of area covered by KK coats of paint, he is not very happy. He is willing to paint up to two additional rectangles to try and increase this area, as long as these two rectangles are disjoint (not sharing any positive amount of area in common). Note that he can also decide to paint zero new rectangles or just one new rectangle if this ends up being the best thing to do.

입력

The first line of input contains NN and KK (1K,N1051 \leq K, N \leq 10^5). Each of the remaining NN lines contains four integers x_1,y_1,x_2,y_2x\_1, y\_1, x\_2, y\_2 describing a rectangular region being painted, with lower-left corner (x_1,y_1)(x\_1, y\_1) and upper-right corner (x_2,y_2)(x\_2, y\_2). All xx and yy values are in the range 02000 \ldots 200, and all rectangles have positive area.

Like the rectangles he already painted, any new rectangles that Farmer John paints must have positive area, and their corner points must have xx and yy coordinates in the range 02000 \ldots 200.

출력

Please output the maximum area of the barn that could be covered by exactly KK coats of paint, if Farmer John paints up to two additional disjoint rectangles.