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

建议使用的浏览器:

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

5392:Infoplane in Tina Town

题目描述
There is a big stone with smooth surface in Tina Town. When people go towards it, the stone surface will be lighted and show its usage. This stone was a legacy and also the center of Tina Town’s calculation and control system. also, it can display events in Tina Town and contents that pedestrians are interested in, and it can be used as public computer. It makes people’s life more convenient (especially for who forget to take a device).

Tina and Town were playing a game on this stone. First, a permutation of numbers from $1$ to $n$ were displayed on the stone. Town exchanged some numbers randomly and Town recorded this process by macros. Town asked Tine,”Do you know how many times it need to turn these numbers into the original permutation by executing this macro? Tina didn’t know the answer so she asked you to find out the answer for her.

Since the answer may be very large, you only need to output the answer modulo $3*{2}^{30}+1=3221225473$ (a prime).
输入解释
The first line is an integer $T$ representing the number of test cases. $ T \leq 5$

For each test case, the first line is an integer $n$ representing the length of permutation. $ n \leq 3*{10}^{6} $

The second line contains $n$ integers representing a permutation $A_1...A_n$. It is guaranteed that numbers are different each other and all $A_i$ satisfies ( $1 \leq A_i \leq n$ ).
输出解释
For each test case, print a number $ans$ representing the answer.
输入样例
2
3
1 3 2
6
2 3 4 5 6 1
输出样例
2
6
来自杭电HDUOJ的附加信息
Recommend hujie

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

源链接: HDU-5392

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

共提交 0

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