polja | 프로그래밍의 벗 PivotOJ
PivotOJ

polja

시간 제한: 2000ms메모리 제한: 64MB출처: CHC 2005 Final Exam #2BOJ 1831
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

Mickey is in the airplane above ground. On the ground, he sees fields of rectangular shapes and different colors, depending on planted vegetation. 

Mickey wants to know what is the area of the largest one-colored rectangle on the ground. 

On the picture you can see examples from the bottom of the page (solution for each example is marked): 

[이미지 1]

Write a program that will calculate the area of the largest one-colored rectangle on the ground. 

Two different fields will not overlap, however they may touch in corners or along sides. 

입력

First line of input contains an integer N, 1 ≤ N ≤ 2500, the number of fields on the ground. Each of the following N lines contains five integers X1, Y1, X2, Y2 (X1<X2, Y1<Y2) and C. 

These numbers represents one field (with sides parallel to coordinate axes) with coordinates of diagonal corners (X1,Y1) and (X2,Y2) and with color C, 1 ≤ C ≤ 100. All the coordinates will be integers between 0 and 1,000,000,000 (inclusive). 

출력

First and only line of output should contain the area from the problem statement. 

Note: solution will always fit into the signed 64-bit integer data type (int64 in Pascal, long long in C/C++). 

예제

예제 1

입력
5
1 1 3 3 1
3 1 5 3 1
1 4 3 6 1
3 4 5 6 1
0 3 6 4 2
출력
8

예제 2

입력
5
5 5 6 6 22
3 4 6 5 22
6 3 7 6 22
5 6 8 7 22
4 5 5 8 22
출력
9

예제 3

입력
7
0 0 4 3 1
6 2 9 7 2
6 7 10 9 3
4 0 6 3 1
0 6 6 9 3
0 3 6 6 2
7 0 8 2 2
출력
27
코드를 제출하려면 로그인하세요.