传送门
按照时间t排序
如果 t[i] + map[i][j] <= t[j],就在i和j之间连一条边
然后spfa找最长路
#include <queue>#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#define N 401using namespace std;int n, ans, cnt;int a[N][N], map[N][N], dis[N], head[N], to[N * 100], next[N * 100];bool vis[N];queue <int> q;struct nodep[N];inline int read()inline bool cmp(node x, node y)inline void spfa()}}}}inline void add(int x, int y)int main()
上一篇:[TyvjP1519] 博彩游戏(AC自动机 + DP)
下一篇:[BZOJ1589] [Usaco2008 Dec]Trick or Treat on the Farm 采集糖果(tarjan缩点 + 记忆化搜索)
最短路 spfa









