当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7245:Photos

题目描述
You have a square farm, divided into $n\times n$ cells. There are $m$ beautiful cells among all cells, whose locations are given. You would like to take some photos of the farm. A photo should figure a square area of the farm, with vertices located on grid points and edges parallel to the grid lines. What's more, its principal diagonal should lie on the principal diagonal of the whole farm.

You would like to take several photos so that each beautiful cell is contained in one photo. You hate repetitions so that any two of your photos should not coincide, that is, their common area is $0$. Each photo can contain an arbitrary number of beautiful cells, possibly $0$, $1$ or more. Count the number of set of photos satisfying the above conditions, modulo $998244353$.

In case you are confused, here we provide an illustration. The farm shown in this illustration is the same as the one in the sample test case.

![vSq3cj.png](https://s1.ax1x.com/2022/07/27/vSq3cj.png)

You are given $T$ independent test cases; solve each of them.
输入解释
The first line of input contains a single integer $T(1\leq T\leq 1500)$, indicating the number of test cases. Then $T$ test cases follow.

The first line of each test case contains two space-separated integers $n,m(1\leq n\leq 10^9,1\leq m\leq 10^5)$, denoting the size of the farm and the number of good cells. Each of the next $m$ lines contains two space-separated integers $x_i,y_i(1\leq x_i,y_i\leq n)$, denoting the coordinates of a good cell.

It is guaranteed that $\sum m\leq 10^6$.
输出解释
For each test case, print a line consisting of a single integer, indicating the answer modulo $998244353$.
输入样例
1
6 2
4 2
3 4
输出样例
24

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7245

最后修改于 2022-09-15T06:17:35+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/3000MS(Java/Others) 524288/524288K(Java/Others)