被Hack了呜呜。。。
求调一下谢谢Becoder数据太水了
#include <bits/stdc++.h>
using namespace std;
const int maxn = 120005;
#define inf 0x3f3f3f3f3f3f3f3f
#define P pair<int, int>
#define int long long
int n, p, k, s, t, dist[maxn];
priority_queue<P, vector<P>, greater<P> > sq;
vector<P> G[maxn];
bool viss[maxn];
void dij() {
memset(dist, 0x3f, sizeof(dist));
dist[s] = 0;
sq.push({0, s});
while(!sq.empty()) {
P t = sq.top();
sq.pop();
if(viss[t.second]) continue;
viss[t.second] = 1;
for(auto i : G[t.second]) {
int y = i.second, w = i.first;
if(dist[y] > dist[t.second] + w) {
dist[y] = dist[t.second] + w;
sq.push({dist[y], y});
}
}
}
}
signed main() {
cin >> n >> p >> k;
cin >> s >> t;
for (int x, y, z, i = 1; i <= p; i++) {
cin >> x >> y >> z;
for (int j = 0; j <= k; j++) {
G[x + j * n].push_back({z, y + j * n});
G[y + j * n].push_back({z, x + j * n});
G[x + j * n].push_back({0, y + (j + 1) * n});
G[y + j * n].push_back({0, x + (j + 1) * n});
}
}
dij();
cout << dist[k * n + t];
return 0;
}