摘要:
题目源https://www.nowcoder.com/acm/contest/181/D 一看到这题,诶,有树,求最长路,于是,很自然的什么都没想到,于是,就想跑两遍spfa来求解,样例过去,没AC; 然后知道这道题其实就是一道赤果果的树的直径的模板题,去搜了一下资料:树的直径用两遍dfs就搞出来 阅读全文
posted @ 2018-08-31 21:05
南柯一场
阅读(170)
评论(0)
推荐(0)
摘要:
#include using namespace std; int n,m,s; struct node{ int to,next,w; }e[900000]; bool pc; int dis[10000000],head[100000],vis[100000]; inline void read(int &x) { x=0;int f=1;char s=getchar(); ... 阅读全文
posted @ 2018-08-31 20:08
南柯一场
阅读(634)
评论(0)
推荐(0)
摘要:
关于spfa优化和判环 https://blog.csdn.net/liangzhaoyang1/article/details/62423135 https://blog.csdn.net/crybymyself/article/details/53165306 https://blog.csdn 阅读全文
posted @ 2018-08-31 00:02
南柯一场
阅读(292)
评论(0)
推荐(0)

浙公网安备 33010602011771号