IxlOA #4
Prison Break
估计简单可在线判题
考点(AI 标注)原地数组
Find the longest consecutive run of removed horizontal bars and of removed vertical bars separately; the side length of the largest hole is the length of the consecutive run plus 1.
输入格式
The first line contains n, m, |h|, |v|; the second line gives the indices of the removed horizontal bars, and the third line gives the indices of the removed vertical bars. 1≤n,m≤100000; the arrays are non-empty and the indices lie within 1..n/m respectively; each bar appears at most once.
输出格式
Output the area of the largest hole (64-bit integer).
样例 1
输入:
6 6 3 2
1 2 4
2 3
输出:
9
样例说明
Derive a linear-scan/dynamic-programming solution directly from the problem rules; the examples have been checked case by case against an independently built oracle.