#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ll long long
#define pb push_back
#define uwu 100005
vector<pair<int,int>>adj[uwu];
long double solve(int N, int M, int K, int H, vector<int> x, vector<int>y, vector<int> c, vector<int> arr){
int father[N];
long double yol[N];
for(int i=0;i<N;i++){
father[i]=-1;
yol[i]=1000000000000000;
}
for(int i=0;i<M;i++){
adj[x[i]].pb({y[i],c[i]});
adj[y[i]].pb({x[i],c[i]});
}
priority_queue<tuple<double,int,int>> pq;
pq.push({-0.0,0,-1});
while(pq.size()){
ll int node,once;double deg;
tie(deg,node,once)=pq.top();deg=-deg;
pq.pop();
//cout<<node<<" "<<once<<" "<<" "<<deg<<" "<<endl;
if(yol[node]<=deg)continue;
if(arr[node]==0){
deg=0;
}
yol[node]=deg;
father[node]=once;
for(auto u:adj[node]){
int kim=u.first;double lira=u.second;
pq.push({-(deg+lira),kim,node});
}
}
/*for(int i=0;i<N;i++)cout<<yol[i]<<" ";
cout<<endl;
for(int i=0;i<N;i++)cout<<father[i]<<" ";
cout<<endl;*/
for(int i=0;i<N;i++)adj[i].clear();
if(father[H]==-1)yol[H]=-1;
return yol[H];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
2884 KB |
Double -26160 violates the range [-1, 1e+18] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
3024 KB |
Double -8.14697e+09 violates the range [-1, 1e+18] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
33 ms |
3176 KB |
Double -1.98332e+09 violates the range [-1, 1e+18] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
31 ms |
7688 KB |
Double -1.37569e+10 violates the range [-1, 1e+18] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
3044 KB |
Double -5.12138e+09 violates the range [-1, 1e+18] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
27 ms |
3040 KB |
Double -2.83956e+09 violates the range [-1, 1e+18] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
31 ms |
3060 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
3100 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |