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

建议使用的浏览器:

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

5197:DZY Loves Orzing

题目描述
DZY has a $n \times n$ square matrix which is used to Orz JRY. Every morning,

DZY always finds $n^2$ people with distinct height, and they form a square matrix. Let person $i$ denote the $i$-th shortest person.

When they start to Orz JRY, JRY smiles and starts waving to them. JRY has a requirement. If he looks straight at the $i$-th column, he can see exactly $a_i$ people. If the person $i$ stands in front of the person $j$ and $i>j$, person $j$ is blocked.

JRY wants to know how many different matrices they can form, so he asked DZY to tell him the answer.

Now, DZY is asking you to work out the result.

![](../../data/images/C573-1004-1.jpg)
输入解释
The input consists several test cases.($TestCase\leq 5$)

The first line contains a integer $n(1\leq n\leq 10^5)$.

The second line, $n$ integers $a_i(1\leq a_i\leq n)$.
输出解释
For each query, please print a line containing a number representing the answer modulo $(10^9-51711)$.
输入样例
2
1 2
3
2 1 1
7
2 4 3 5 2 4 3
输出样例
6
20160
67779489

提示
query 1. There are 6 possible ways in the picture.
来自杭电HDUOJ的附加信息
Recommend hujie

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

题目来源 BestCoder Round #35

源链接: HDU-5197

最后修改于 2020-10-25T23:20:37+00:00 由爬虫自动更新

共提交 0

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