这是我滴代码,究竟是什么原因。不开氧气也只能90
#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
const int INF = 0x3f3f3f3f;
int n; int m; int k;
int h[N], e[N], ne[N], w[N], idx;
int dist[N];
bool st[N];
void add(int a, int b, int c)
{
e[idx] = b;
ne[idx] = h[a];
w[idx] = c;
h[a] = idx ++ ;
}
int SPFA(int s)
{
memset(dist, 0x3f, sizeof(dist));
dist[s] = 0;
st[s] = true;
queue<int> q;
q.push(s);
while (!q.empty())
{
int u = q.front(); q.pop();
st[u] = false;
for (register int i = h[u]; i != -1; i = ne[i])
{
int v = e[i];
if (dist[v] > dist[u] + w[i])
{
dist[v] = dist[u] + w[i];
if (!st[v])
{
q.push(v);
st[v] = true;
}
}
}
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
memset(h, -1, sizeof(h));
cin >> n >> m >> k;
for (register int i = 1; i <= m; i ++ )
{
int u, v, w;
cin >> u >> v >> w;
add(u, v, w), add(v, u, w);
for (int j = 1; j <= k; j ++ )
{
add(u + (j - 1) * n, v + j * n, w / 2);
add(v + (j - 1) * n, u + j * n, w / 2);
add(u + j * n, v + j * n, w);
add(v + j * n, u + j * n, w);
}
}
for (register int i = 1; i <= k; i ++ )
add(n + (i - 1) * n, n + i * n, 0);
SPFA(1);
cout << dist[n + k * n] << endl;
return 0;
}