摘要: // Bellman-Ford算法 O(nm) #include<bits/stdc++.h> #define INF 0X3F3F3F3F using namespace std; const int N=1e4+5; struct node { int v, w; }; vector<node> 阅读全文
posted @ 2026-02-23 20:41 huangguougo 阅读(2) 评论(0) 推荐(0)
摘要: // Heap Dijkstra o(mlogm) #include <bits/stdc++.h> using namespace std; const int N=100005, INF=0X3F3F3F3F; int d[N]; bool vis[N]; int n, m, s; struct 阅读全文
posted @ 2026-02-23 20:39 huangguougo 阅读(1) 评论(0) 推荐(0)
摘要: // 朴素dijkstra o(nm) #include <bits/stdc++.h> using namespace std; const int N=10005; const int INF=0X3F3F3F3F; int d[N]; bool vis[N]; int n, m, s; str 阅读全文
posted @ 2026-02-23 20:08 huangguougo 阅读(4) 评论(0) 推荐(0)
摘要: //Kahn算法 o(n+m) #include <bits/stdc++.h> using namespace std; const int N=100005; vector<int> g[N]; int deg[N]; int n; void topo() { queue<int> q; for 阅读全文
posted @ 2026-02-23 19:58 huangguougo 阅读(6) 评论(0) 推荐(0)