Maximum Area(Contest)
Maximum Area medium Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Maximum Area medium Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
Saurabh has a paper of size N*M and some horizontal and vertical lines in the form of arrays. Saurabh wants to know the maximum area which is trapped inside the lines.
Note:- Consider the boundary of the paper to be vertical and horizontal lines. Also consider 0 indexing Input The first line of input contains 4 space separated integers depicting N, M, size of array contains horizontal lines(H), size of array containing vertical lines(V). The second line contains H space separated integers depicting horizontal lines. Last lines contains V space separated integers depicting vertical lines.
Constraints:- 1 <= N, M <= 1000000000 1 <= H, V <= 100000 0 <= horizontal lines <= N 0 <= vertical lines <= M Output Print the maximum area trapped between the lines Example Sample Input:- 5 4 3 2 1 2 4 1 3
Sample Output:- 4
Explanation:- The area is- (2,1), (2,3) (4,1) (4,3)
Sample Input:- 5 4 2 1 3 1 1
Sample Output:- 6
link: