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

建议使用的浏览器:

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

6818:Array Repairing

题目描述
Given an integer $n$, a sequence $a[1..n]$ is randomly generated with equal probability, namely, $a_i \in [1,n]$, $\forall i \in [1,n]$. Note that it may be not a permutation of $1..n$.

To turn it into $a_i=i,\forall i \in [1,n]$, you can perform any of the following two operations for any times:

1.Choose $i,j \in [1,n],i\not = j$, swap $a_i,a_j$ costing $1$.

2.Choose $i,v \in [1,n]$, set $a_i = v$ costing $k$.

For example, if you perform operations of the first kind for $5$ times and perform operations of the second kind for $4$ times, then it will cost you $4 \times k + 5$.

Denote $cost_k(a)$ as the minimum total cost for the sequence $a$ with the parameter $k$. For each $k \in [0,2]$, print the mathematical expectation $E(cost_k(a))$ $mod$ $998244353 $.

Now, you need to answer the above question for each $n \in [1,N]$. That is to say, you should print $3 \times N$ values in total.

输入解释
One line contains only one integer $N$, $N \in [1,\ 5 \times 10^5]$.
输出解释
You should output $N$ lines with each containing $3$ values $E(cost_k(a))$ $mod$ $998244353 $, $\forall k \in [0,2]$ separated by two spaces.
输入样例
example 1:
1

example 2:
2
输出样例
example 1:
0 0 0

example 2:
0 0 0
0 249561089 748683266
来自杭电HDUOJ的附加信息
Recommend IceyWang

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

源链接: HDU-6818

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

共提交 0

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