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

建议使用的浏览器:

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

6511:Min-Max

题目描述
This problem is about two very common functions $~min(a, b)~$ and $~max(a, b)~$, the function $~min(a, b)~$ returns the smaller of $~a~$ and $~b~$, and function $~max(a, b)~$ returns the bigger one.

Now, you are given a permutation $a_1, a_2,...,a_n$, and $~m~$ expressions, the $~ith~$ expression will one of the follows

1. $b_i = min(X, Y)$
2. $b_i = max(X, Y)$

Where $~X~$, $~Y~$ can be $~a_j(1 \leq j \leq n)~$ or $~b_j(1 \leq j <i)~$.
And the questions is, if we randomly choose permutation $a_1, a_2,...,a_n$ with equal probability, what is the expected value of $~b_m~$.
输入解释
The input data contains server test case(end with EOF), for each test case
The first line contain two integer $~n~$ and $~m~$. ($2 \leq n \leq 15, 1 \leq m \leq 1000$)
Then following $~m~$ lines, the $ith$ line describe the right side of the $~ith~$ expression(note that the left side is always be $~b_i=~$), and is one of the follows:
1. $min\, tp_0\, id_0\, tp_1\, id_1$
2. $max\, tp_0\, id_0\, tp_1\, id_1$
The pair $(tp, id)$ describe one variable, if tp is 'a', then it means $~a_{id}~$, else tp will be 'b', and it means $~b_{id}~$
输出解释
One line contain one integer $E[b_m] \times n!$, it can be prove, that the result always be an integer.
输入样例
3 2
max a 2 a 3
min a 1 b 1
3 2
max a 2 a 3
max a 1 b 1
输出样例
10
18
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6511

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

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)