## CCO '11 P6 - Biggest (Zero Carbon) Footprint

View as PDF

Points: 25 (partial)
Time limit: 2.5s
Memory limit: 256M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
##### Canadian Computing Competition: 2011 Stage 2, Day 2, Problem 3

Having just recently won the lottery, you decide to build a summer resort nestled deep in a forest. However, being a very eco-friendly person, you decide not to cut down any of the trees that grow in the forest. Given a map of the forest and the positions of its trees, determine the area of the largest rectangular plot you can buy that does not contain any of the trees. (Note that your plot must have edges which are parallel to the and axes.)

#### Input Specification

The first line contains , , and (, ) representing the dimensions of the given map of the forest and the number of trees indicated on the map respectively. The next lines each contain two integers and () describing the location of each tree (where is the bottom leftmost point on the map and is the top rightmost point on the map).

Note: for 20% of the marks for this question, you may assume that , and for 45% of the marks for this question, .

#### Output Specification

Output the area of the largest rectangle that does not contain any of the given trees.

#### Sample Input

5 5 2
1 1
3 3

#### Output for Sample Input

12