#15771. [SDCPC 2023] Be Careful 2
[SDCPC 2023] Be Careful 2
[SDCPC 2023] Be Careful 2
题目描述
Little Cyan Fish has an $n \times m$ rectangle located in a plane. The top-right corner of the rectangle is at $(n, m)$, while the bottom-left corner is at $(0, 0)$. There are $k$ banned points inside the rectangle. The $i$-th banned point is located at $(x_i, y_i)$.Little Cyan Fish would like to draw a square inside the rectangle. However, he dislikes all the banned points, so there cannot be any banned points inside his square. Formally, Little Cyan Fish can draw a square with the bottom-left corner at and a side length if and only if:
- Both and are non-negative integers while is a positive integer.
- .
- .
- For each , the following condition must NOT be met:
- and .
Please calculate the sum of the areas of all the squares that Little Cyan Fish can possibly draw. Since the answer could be huge, you need to output it modulo .
输入格式
The is only one test case in each test file.The first line of the input contains three integers , and (, ) indicating the size of the rectangle and the number of banned points.
For the following lines, the -th line contains two integers and (, ) indicating the position of the -th banned point. It is guaranteed that all the banned points are distinct.
输出格式
Output one line containing one integer indicating the answer modulo $998244353$.3 3 1
2 2
21
5 5 2
2 1
2 4
126
提示
For the first sample test case, Little Cyan Fish has $12$ ways to draw a square, illustrated as follows.
There are squares of side length and squares of side length . So the answer is .
Note that the following plans are invalid since there's a banned point in the square.
标签: P9563|2023|山东|O2优化|容斥原理|省赛/邀请赛