~~感谢大佬让我发现我任务计划满了~~
by 33028120040712wcl @ 2018-11-01 20:24:15
……
by 上帝信佛 @ 2018-11-02 19:48:13
还是不作死了用最小生成树先a掉吧,希望路过的大佬还是帮我改一下
by 上帝信佛 @ 2018-11-02 19:49:06
```cpp
#include<bits/stdc++.h>
#define getmax(a, b) (a < b ? b : a)
using namespace std;
const int maxn = 100001;
inline int read() {
int x = 0, f = 1, ch = getchar();
for(; ch < '0' || ch > '9'; ch = getchar()) if(ch == '-') f = -1;
for(; ch >= '0' && ch <= '9'; ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
return x * f;
}
struct node {
int next, to, dist;
}edge[maxn];
int h[maxn], num = 0, dis[maxn], n, m, s, t;
bool vis[maxn];
inline void add(int a, int b, int c) {
edge[++num] = (node) {h[a], b, c}; h[a] = num;
}
inline int SPFA() {
for(int i = 1; i <= n; ++i) dis[i] = 0x7f7f7f7f, vis[i] = 0;
queue <int> q;
dis[s] = 0; vis[s] = 1; q.push(s);
while(!q.empty()) {
int u = q.front(); q.pop(); vis[u] = 0;
for(int i = h[u]; i; i = edge[i].next) {
int v = edge[i].to;
if(dis[v] > getmax(edge[i].dist, dis[u])) {
dis[v] = getmax(edge[i].dist, dis[u]);
if(!vis[v]) {
vis[v] = 1;
q.push(v);
}
}
}
}
return dis[t];
}
int main() {
n = read(); m = read(); s = read(); t = read();
for(int i = 1, a, b, c; i <= m; ++i) {
a = read(); b = read(); c = read();
add(a, b, c); add(b, a, c);
}
cout << SPFA();
return 0;
}
```
by Wisbtsml @ 2018-12-13 18:35:50
@[上帝信佛](/space/show?uid=70518)
by Wisbtsml @ 2018-12-13 18:36:36
你的前向星打错了
by Wisbtsml @ 2018-12-13 18:37:22
不要先把tot设成1,
by Wisbtsml @ 2018-12-13 18:44:28
@[Wisbtsml](/space/show?uid=87977) okk我试一下,感谢大佬
by 上帝信佛 @ 2018-12-22 14:12:15