Carpet | 프로그래밍의 벗 PivotOJ
PivotOJ

Carpet

시간 제한: 2000ms메모리 제한: 1024MB출처: NOI 2002BOJ 9908

문제

Given a rectangular configuration representing a floor plan, where ‘#’ indicates a pillar and ‘.’ a clear space:

...#...#..
..##.#....
......#.#.
.#........
.........#
.....#.#..

What is the area (number of dots) of the largest rectangular carpet whose edges are parallel to the boundary of the floor that can be laid on this piece of land?  For the example above, the largest carpet is represented with ‘*’ symbols:

...#...#..
..##.#....
......#.#.
.#*******.
..*******#
.....#.#..

The area of this carpet is 14.

The rows are numbered from top to bottom starting from row 1, and the columns are numbered from left to right starting from column 1. You can assume that there are at most 20 rows and at most 40 columns.

입력

The input consists of the following lines:

  1. The first line contains 2 integers indicating the number of rows and number of columns of the floor plan, respectively.
  2. The second line consists of a positive integer n indicating the number of pillars.
  3. Each of the subsequent n lines consists of the position of a pillar, represented as 2 integers separated by a space.  The first integer represents the row number and the second integer represents the column number.

출력

The output contains a single integer value, which is the area of the largest carpet that can be laid on the floor. 

예제

예제 1

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