#include <bits/stdc++.h>
using namespace std;
const int N=100000;
vector<pair<int,double>> edges[N];
bool visited[N]={};
double ans[N];
double solve(int n,int m,int k,int h,vector<int> x,vector<int> y,vector<int> c,vector<int> a){
for(int i=0;i<n;i++) ans[i]=-1;
for(int i=0;i<m;i++){
edges[x[i]].push_back(make_pair(y[i],(double) c[i]));
edges[y[i]].push_back(make_pair(x[i],(double) c[i]));
}
priority_queue<pair<double,int>,vector<pair<double,int>>,greater<pair<double,int>>> pq;
ans[0]=0;
pq.push(make_pair(0,0));
for(int i=0;i<n;i++){
if(a[i]==0){
ans[i]=0;
pq.push(make_pair(0,i));
}
}
while(!pq.empty()){
auto u=pq.top();
pq.pop();
if(u.first!=ans[u.second]) continue;
for(auto v:edges[u.second]){
if(ans[v.first]==-1 || ans[v.first]>u.first+v.second){
ans[v.first]=u.first+v.second;
pq.push(make_pair(ans[v.first],v.first));
}
}
}
double fans=ans[h];
for(int i=0;i<n;i++){
edges[i].clear();
visited[i]=false;
ans[i]=0;
}
return fans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
3672 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
3672 KB |
Correct. |
2 |
Correct |
20 ms |
3672 KB |
Correct. |
3 |
Correct |
19 ms |
3672 KB |
Correct. |
4 |
Correct |
20 ms |
3676 KB |
Correct. |
5 |
Correct |
20 ms |
3672 KB |
Correct. |
6 |
Correct |
18 ms |
4440 KB |
Correct. |
7 |
Correct |
22 ms |
4440 KB |
Correct. |
8 |
Correct |
12 ms |
5208 KB |
Correct. |
9 |
Correct |
19 ms |
3416 KB |
Correct. |
10 |
Correct |
20 ms |
3416 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
3672 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
8660 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
3672 KB |
Correct. |
2 |
Correct |
21 ms |
4788 KB |
Correct. |
3 |
Correct |
24 ms |
4704 KB |
Correct. |
4 |
Correct |
20 ms |
5716 KB |
Correct. |
5 |
Correct |
16 ms |
4184 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
22 ms |
3928 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
3768 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
3672 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |