#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
double djicstra(int n, int m, int k, int h, vector<vector<pll> >& g) {
vector<ll> dist(n, 1e15);
dist[0] = 0;
priority_queue<pll, vector<pll >, greater<pll > > q;
q.push({0, 0});
while(!q.empty()) {
auto [d, v] = q.top();
q.pop();
if (d != dist[v]) continue;
for (auto [to, c] : g[v]) {
q.push({c + d, to});
dist[to] = min(c + d, dist[to]);
}
}
return dist[h];
}
double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) {
vector<vector<pll > > g(N);
for (int i = 0; i < M; i++) {
g[x[i]].push_back({y[i], c[i]});
g[y[i]].push_back({x[i], c[i]});
}
return djicstra(N, M, K, H, g);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
600 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
596 KB |
Correct. |
2 |
Correct |
26 ms |
600 KB |
Correct. |
3 |
Correct |
25 ms |
600 KB |
Correct. |
4 |
Correct |
26 ms |
604 KB |
Correct. |
5 |
Correct |
26 ms |
600 KB |
Correct. |
6 |
Correct |
22 ms |
1664 KB |
Correct. |
7 |
Correct |
36 ms |
1436 KB |
Correct. |
8 |
Correct |
13 ms |
2800 KB |
Correct. |
9 |
Correct |
24 ms |
344 KB |
Correct. |
10 |
Correct |
23 ms |
344 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
604 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
6744 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
604 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
636 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
604 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
600 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |