[Problem] \color{green}{\texttt{[Problem]}} [Problem]
- 给定一个 n n n 个点 m m m 条边的无向图,求出一个至少有 3 3 3 个点的环,使得环上的边的边权的总和最小。无解就输出
No solution.
(注意,.
是必须的)。 - 1 ≤ n ≤ 100 , 1 ≤ m ≤ 5 × 1 0 3 1 \leq n \leq 100,1 \leq m \leq 5 \times 10^3 1≤n≤100,1≤m≤5×103。
- 记 d d d 为边权的最大值,则有 1 ≤ d ≤ 1 × 1 0 5 1\leq d \leq 1 \times 10^5 1≤d≤1×105。
[Solution] \color{green}{\texttt{[Solution]}} [Solution]
[Part one] \color{blue}{\texttt{[Part one]}} [Part one] Floyd
的本质是什么?
对于很多人(包括一年前的笔者)而言,Floyd
算法就是:
for(int k=1;k<=n;k++)
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
f[i][j]=min(f[i][j],f[i][k]+f[k][j]);
这样一个 O ( n 3 ) O\left (n^3\right) O(