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

建议使用的浏览器:

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

6415:Rikka with Nash Equilibrium

题目描述
Nash Equilibrium is an important concept in game theory.

Rikka and Yuta are playing a simple matrix game. At the beginning of the game, Rikka shows an $n \times m$ integer matrix $A$. And then Yuta needs to choose an integer in $[1,n]$, Rikka needs to choose an integer in $[1,m]$. Let $i$ be Yuta's number and $j$ be Rikka's number, the final score of the game is $A_{i,j}$.

In the remaining part of this statement, we use $(i,j)$ to denote the strategy of Yuta and Rikka.

For example, when $n=m=3$ and matrix $A$ is
\begin{align*}
\begin{bmatrix}
1 & 2 & 1\\
1 & 4 & 3\\
1 & 1 & 1\\
\end{bmatrix}
\end{align*}
If the strategy is $(1,2)$, the score will be $2$; if the strategy is $(2,2)$, the score will be $4$.

A pure strategy Nash equilibrium of this game is a strategy $(x,y)$ which satisfies neither Rikka nor Yuta can make the score higher by changing his(her) strategy unilaterally. Formally, $(x,y)$ is a Nash equilibrium if and only if:
\begin{align*}
\begin{cases}
A_{x,y} \geq A_{i,y} \ \ \forall i \in [1, n] \\
A_{x,y} \geq A_{x,j} \ \ \forall j \in [1,m]
\end{cases}
\end{align*}

In the previous example, there are two pure strategy Nash equilibriums: $(3,1)$ and $(2,2)$.

To make the game more interesting, Rikka wants to construct a matrix $A$ for this game which satisfies the following conditions:
1. Each integer in $[1, nm]$ occurs exactly once in $A$.
2. The game has at most one pure strategy Nash equilibriums.

Now, Rikka wants you to count the number of matrixes with size $n \times m$ which satisfy the conditions.
输入解释
The first line contains a single integer $t(1 \leq t \leq 20)$, the number of the testcases.

The first line of each testcase contains three numbers $n,m$ and $K(1 \leq n,m \leq 80, 1 \leq K \leq 10^9)$.

The input guarantees that there are at most $3$ testcases with $\max(n,m) > 50$.
输出解释
For each testcase, output a single line with a single number: the answer modulo $K$.
输入样例
2
3 3 100
5 5 2333
输出样例
64
1170
来自杭电HDUOJ的附加信息
Recommend chendu

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

源链接: HDU-6415

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

共提交 0

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