1、算法竞赛进阶指南,363页
2、先将点的编号离散化
3、图的邻接矩阵A, A^m 表示任意两点经过 m条边的最短路
(A^(r + m))[i, j] = min[(A^r)[i, k], (A^m)[k, j]], 其中 1 <= k <= P
“广义矩阵乘法”:原来乘法用加法替代,原来加法用min 替代。
https://fanfansann.blog.luogu.org/solution-p2886
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int N = 110;
int n, t, st, ed;
int w[N], l[N], r[N];
ll A[N][N];
vector<int> v;
int m;
struct matrix
{
ll c[N][N];
matrix()
{
memset(c, 0, sizeof c);
}
};
void discrete()
{
sort(v.begin(), v.end());
v