本来是一道傻叉题目,结果不认真看题被坑了。。
要求差最大,由于最短路不固定,所以要枚举而不能直接算出最长边然后*2,,我一开始floyd爆草结果WA了无数发。。后来才知道spfa直接枚举就好了。。
顺便贴一下三种最短路记录路径的方法。
http://blog.csdn.net/chenzhenyu123456/article/details/46670451
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
using namespace std;
#define LL long long
#define N 25005
int n,m,x,y;LL z,ans;
int tot,point[N],nxt[N*