#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>> graph[100001];
vector<vector<int>> edges;
void add_edge(int u,int v,int w) {
graph[u].push_back({v,w});
graph[v].push_back({u,w});
edges.push_back({u,v,w});
}
vector<int> dijsktras(int src, int N) {
vector<int> dis(N, INT_MAX);
vector<bool> vis(N, false);
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>> pq;
pq.push({0,src});
dis[src] = 0;
while (!pq.empty()) {
auto cur = pq.top();
pq.pop();
int node = cur.second;
int weight = cur.first;
if (vis[node])
continue;
vis[node] = true;
for (auto child : graph[node]) {
if (dis[child.first] > child.second + weight) {
dis[child.first] = weight + child.second;
pq.push({dis[child.first], child.first});
}
}
}
return dis;
}
double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr) {
for (int i=0;i<M;i++) {
add_edge(x[i],y[i],c[i]);
}
vector<int> disA = dijsktras(0, N);
double ans = disA[H];
for (int i=0;i<100001;i++) {
graph[i].clear();
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
718 ms |
3920 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
6172 KB |
Double -1.40446e+09 violates the range [-1, 1e+18] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
6356 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
10016 KB |
Double -6.15963e+08 violates the range [-1, 1e+18] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
6116 KB |
Double -4.06878e+08 violates the range [-1, 1e+18] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
6456 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
36 ms |
6416 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
5644 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |