#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
double solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> v) {
vector<vector<pll>> g(n);
for (ll i = 0; i < m; i++) {
ll a = x[i], b = y[i], cost = c[i];
g[a].push_back({b, cost});
g[b].push_back({a, cost});
}
vector<ll> dist(n, 1e16 + 10);
dist[0] = 0;
priority_queue<pll, vector<pll>, greater<pll>> q;
q.push({0, 0});
while (!q.empty()) {
auto [curcost, v] = q.top();
q.pop();
if (curcost != dist[v]) continue;
for (auto [to, cost] : g[v]) {
if (dist[to] > dist[v] + cost) {
dist[to] = dist[v] + cost;
q.push({dist[to], to});
}
}
}
return dist[h];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
600 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
604 KB |
Correct. |
2 |
Correct |
22 ms |
580 KB |
Correct. |
3 |
Correct |
24 ms |
604 KB |
Correct. |
4 |
Correct |
22 ms |
604 KB |
Correct. |
5 |
Correct |
28 ms |
580 KB |
Correct. |
6 |
Correct |
24 ms |
1436 KB |
Correct. |
7 |
Correct |
25 ms |
1440 KB |
Correct. |
8 |
Correct |
12 ms |
2652 KB |
Correct. |
9 |
Correct |
21 ms |
348 KB |
Correct. |
10 |
Correct |
23 ms |
516 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
604 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
6744 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
604 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
20 ms |
600 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
20 ms |
604 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
20 ms |
604 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |