题目描述
Problem Description
dwango corporation has $ N $ radio towers, all of which are aligned in a straight line. When this line is considered as a number line, the $ i $th radio tower is located at coordinate $ x_i $ with height $ h_i $. For various reasons, $ x_i $ and $ h_i $ are all positive even numbers. Additionally, for any $i \neq j$, $x_i \neq x_j$ and $h_i \neq h_j$ are satisfied.
Each radio tower can only send information to another tower that has a greater coordinate and height.
Niwango-kun likes information that has been relayed through more radio towers. Therefore, he gains happiness equal to the maximum length of a sequence of integers $ a_1, a_2, ..., a_t $ such that $ x_{a_k} < x_{a_{k+1}} $ and $ h_{a_k} < h_{a_{k+1}} $ for all $1 \leq k \leq t-1$.
dwango corporation has decided to build one new radio tower for Niwango-kun. For various reasons, the coordinate and height of this new tower must both be positive odd numbers.
Determine how many possible pairs of $ (coordinate, height) $ for the new tower can increase Niwango-kun's happiness.
Note that there are powerful magnetic storms in places with coordinates greater than $ W $ or heights greater than $ H $, so no radio towers can be placed or built there.
Input Format
The input is given from the standard input in the following format:
$ N $ $ W $ $ H $ $ x_1 $ $ h_1 $ . . . $ x_N $ $ h_N $
- The first line contains integers $N(1 \leq N \leq 252525)$, $W(4 \leq W \leq 10^9, W$, and $H(4 \leq H \leq 10^9, H$, separated by spaces.
- The following $ N $ lines contain integers representing the coordinate and height of the $ i $th radio tower, $x_i(2 \leq x_i \leq W-2, x_i$ and $h_i(2 \leq h_i \leq H-2, h_i$, separated by spaces.
- For all $i(1 \leq i \leq N-1)$, $ x_i < x_{i+1} $ is satisfied. Also, if $i \neq j$, then $h_i \neq h_j$ is satisfied.
Output Format
Output a single integer representing the number of possible pairs of $ (coordinate, height) $ for the new radio tower that can increase Niwango-kun's happiness. Note that the output may not fit within a 32-bit signed integer.
Do not forget to add a newline at the end of the output.
Sample Input and Output
Sample Input #1
2 6 6
2 4
4 2
Sample Output #1
6
Sample Input #2
4 10 12
2 6
4 2
6 10
8 4
Sample Output #2
16
Sample Input #3
4 10 10
2 6
4 8
6 2
8 4
Sample Output #3
12
Sample Input #4
5 252525252 555255252
25252 52525252
22225252 2225252
55252252 552222222
252522222 52
252525222 555222222
Sample Output #4
7475142133811101
Notes/Hints
Partial Points
This problem has partial points.
- If you solve the dataset where $N \leq 52$, you will be awarded 20 points.
- If you also solve the dataset where $N \leq 2525$, you will be awarded an additional 20 points.
- If you solve all datasets, you will be awarded an additional 80 points, totaling 120 points.
Sample Explanation 1
The possible pairs of $ (coordinate, height) $ are $ (1,1), (1,3), (3,1), (3,5), (5,3), (5,5) $, totaling 6 pairs.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分