#include "cyberland.h"
#include<bits/stdc++.h>
#include <vector>
using namespace std;
#define ll long long
const ll INF=1e18;
double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) {
vector<vector<pair<int,int>>>v(N);
for(int i=0;i<N-1;i++){
v[x[i]].push_back({y[i],c[i]});
v[y[i]].push_back({x[i],c[i]});
}
vector<bool>vis(N,0);
priority_queue<pair<int,int>>q;
vector<ll>dp(N,INF);
dp[0]=0;
q.push({0,0});
while(!q.empty()){
int x=q.top().second;
q.pop();
if(vis[x]) continue;
vis[x]=true;
for(auto [z,y]:v[x]){
if(dp[x]+y<dp[z]){
dp[z]=dp[x]+y;
q.push({-dp[z],z});
}
}
}
if(dp[H]==INF) return -1;
return 1.0*dp[H];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
604 KB |
Correct. |
2 |
Correct |
24 ms |
576 KB |
Correct. |
3 |
Correct |
21 ms |
600 KB |
Correct. |
4 |
Correct |
21 ms |
348 KB |
Correct. |
5 |
Correct |
22 ms |
604 KB |
Correct. |
6 |
Correct |
17 ms |
1180 KB |
Correct. |
7 |
Correct |
23 ms |
1212 KB |
Correct. |
8 |
Correct |
9 ms |
2396 KB |
Correct. |
9 |
Correct |
21 ms |
348 KB |
Correct. |
10 |
Correct |
20 ms |
344 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
564 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
5724 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
860 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |