摘要: AcWing 852. spfa判断负环 #include <cstring> #include <iostream> #include <algorithm> #include <queue> using namespace std; const int N = 2010, M = 10010; 阅读全文
posted @ 2020-09-19 22:34 30天CF上蓝!!! 阅读(145) 评论(0) 推荐(0) 编辑
摘要: acwing851—spfa求最短路 #include<iostream> #include<cstring> #include<algorithm> #include<queue> using namespace std; const int N=1e5+10; int n,m; int idx, 阅读全文
posted @ 2020-09-19 21:06 30天CF上蓝!!! 阅读(130) 评论(0) 推荐(0) 编辑
摘要: int pre[N];//pre[x]=y表示节点x的前驱节点时y void print_path(int a,int b)//打印从节点a到节点b的路径 { if(a==b){printf("%d",s),return ;} printf_path(a,pre[b]) printf("%d",b) 阅读全文
posted @ 2020-09-19 20:37 30天CF上蓝!!! 阅读(112) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<algorithm> #include<cstring> using namespace std; const int N=510,M=1e4+10; int n,m,k,dis[N],backup[N]; //dis数组表示dis[i]到起点 阅读全文
posted @ 2020-09-19 19:45 30天CF上蓝!!! 阅读(163) 评论(0) 推荐(0) 编辑