版本比较
证明:矩阵乘法存在 O(n^2) 做法
正文
增加 25 行删除 8 行
123442 行未改动47484950515253545513 行未改动69707172737475767778792 行未改动828384858687888990919293949596979899100101> 申明:本文没有使用 AI。## 前置知识42 行未改动注意到这份代码什么都没输出。什么,你说这份代码没有覆盖所有的可能性?[CCF](https://www.noi.cn/xw/2025-11-06/851628.shtml):「5.对使用随机数和随机算法的程序的申诉,不予受理;」证毕。$\blacksquare$> **引理 2**:$+$ 和 $\times$ 都是实数。13 行未改动int x = rand();return 0;}```什么,你说什么?[CCF](https://www.noi.cn/xw/2025-11-06/851628.shtml):「5.对使用随机数和随机算法的程序的申诉,不予受理;」证毕。$\blacksquare$---2 行未改动> **矩阵内积(Frobenius 内积)**:对于两个矩阵 $A,B$,其内积常记为 $(A,B) = \operatorname{tr}(A^TB)$。根据计算机图形学,$+^{T}=+, \times^{T}=\times$,因此:> $(+,+) = ++$>> $(\times,\times) = \times\times$>> $(\times,+) = \times+$代入 $a=+,b=\times$。$$\begin{align*}\max(++, \times\times)&\ge+\times \\\max\left((+,+), (\times,\times)\right)&\ge(\times,+) \\\max\left(O(n^2), O(n^2)\right)&\ge(\times,+) \\O(n^2)&\ge(\times,+)\end{align*}$$12345642 行未改动49505152535455565713 行未改动71727374757677787980818283842 行未改动87888990919293949596979899100101102103104105106107108109110111112113114115116117118听说在 CSP 前写专栏能增加 $316381099$ 的 rp。> 申明:本文没有使用 AI。## 前置知识42 行未改动注意到这份代码什么都没输出。什么,你说这份代码没有覆盖所有的可能性?「5.对使用随机数和随机算法的程序的申诉,不予受理;」—— [CCF](https://www.noi.cn/xw/2025-11-06/851628.shtml)证毕。$\blacksquare$> **引理 2**:$+$ 和 $\times$ 都是实数。13 行未改动int x = rand();return 0;}```注意到这份代码通过了编译。什么,你说什么?「5.对使用随机数和随机算法的程序的申诉,不予受理;」—— [CCF](https://www.noi.cn/xw/2025-11-06/851628.shtml)证毕。$\blacksquare$---2 行未改动> **矩阵内积(Frobenius 内积)**:对于两个矩阵 $A,B$,其内积常记为 $(A,B) = \operatorname{tr}(A^TB)$。钦定 $+$ 和 $\times$ 可以是 $1 \times 1$ 的矩阵,根据计算机图形学,$+^{T}=+, \times^{T}=\times$,因此:> $(+,+) = \operatorname{tr}(++) = ++$>> $(\times,\times) = \operatorname{tr}(\times\times) = \times\times$>> $(\times,+) = \operatorname{tr}(\times+) = \times+$代入 $a=\times,b=+$。$$\begin{align*}\max(++, \times\times)&\ge\times+ \\\max\left((+,+), (\times,\times)\right)&\ge(\times,+) \\\max\left(O(n^2), O(n^2)\right)&\ge(\times,+) \\O(n^2)&\ge(\times,+)\end{align*}$$注意到读入矩阵至少需要 $O(n^2)$ 时间,因此我们证明了 $(\times,+)$ 矩阵积存在恰好等于 $O(n^2)$ 的做法。## ???什么,你说[读入矩阵]((https://www.luogu.me/article/8a5v25kf))和[计算矩乘](https://www.luogu.com.cn/article/tb59zu8a)的复杂度都可以达到 $O(0)$?「申诉服务费每题50元」—— [CCF](https://www.noi.cn/xw/2025-11-06/851619.shtml)。前面忘了,可以通过洛谷私信联系我获取缴费通道,绝对不是因为后面忘了。316381099。