IxlOA #2
Growth in 2 Dimensions
估计简单可在线判题
Each operation adds 1 to the rectangle spanning from the bottom-left corner to (r,c); find the number of cells that end up holding the maximum value.
输入格式
The first line contains q (1≤q≤100000), followed by q lines, each with positive integers r and c (≤10^9).
输出格式
Output the number of cells that reach the maximum value (use a 64-bit integer).
样例 1
输入:
3
1 4
2 3
4 1
输出:
1
样例说明
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.