#include "cyberland.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const double 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<double> dist(N, INF);
vector<vector<pair<int,int>>> adj(N);
for (int i = 0; i < M; ++i) {
adj[x[i]].push_back({y[i], c[i]});
adj[y[i]].push_back({x[i], c[i]});
}
priority_queue<pair<double,int>, vector<pair<double,int>>, greater<pair<double,int>>> pq;
arr[0] = 0;
pq.push({0, H});
while(!pq.empty()) {
int cur = pq.top().second;
double d = pq.top().first;
pq.pop();
if (dist[cur] < d) continue;
dist[cur] = d;
if (arr[cur] == 0) return d;
for (auto [nxt, cost] : adj[cur]) {
if (dist[nxt] > d + cost) {
dist[nxt] = d + cost;
pq.push({dist[nxt], nxt});
}
}
}
return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
14 ms |
468 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
468 KB |
Correct. |
2 |
Correct |
23 ms |
424 KB |
Correct. |
3 |
Correct |
18 ms |
452 KB |
Correct. |
4 |
Correct |
19 ms |
444 KB |
Correct. |
5 |
Correct |
19 ms |
440 KB |
Correct. |
6 |
Correct |
15 ms |
1248 KB |
Correct. |
7 |
Correct |
23 ms |
1304 KB |
Correct. |
8 |
Correct |
10 ms |
2268 KB |
Correct. |
9 |
Correct |
19 ms |
340 KB |
Correct. |
10 |
Correct |
19 ms |
380 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
416 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
5696 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
468 KB |
Correct. |
2 |
Correct |
24 ms |
428 KB |
Correct. |
3 |
Correct |
20 ms |
428 KB |
Correct. |
4 |
Correct |
19 ms |
1364 KB |
Correct. |
5 |
Correct |
19 ms |
340 KB |
Correct. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
448 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
18 ms |
440 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
432 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |