#include "cyberland.h"
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 99;
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) {
vector<array<int, 2>> g[N + 1];
for (int i = 0;i < M;i ++) {
g[x[i]].push_back({y[i], c[i]});
g[y[i]].push_back({x[i], c[i]});
}
vector<int> dp(N + 1, inf);
dp[0] = 0;
multiset<array<int, 2>> ms;
ms.insert({0, 0});
while (ms.size() > 0) {
auto it = *ms.begin();
ms.erase(ms.begin());
if (it[1] == H) continue;
for (auto [v, w] : g[it[1]]) if (dp[v] > (arr[v] == 0 ? 0 : it[0] + w)) {
dp[v] = (arr[v] == 0 ? 0 : it[0] + w);
ms.insert({dp[v], v});
}
}
return (dp[H] == inf ? -1 : dp[H]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
592 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
592 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
1360 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
5456 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
592 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
592 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
592 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
1360 KB |
Wrong Answer. |
2 |
Halted |
0 ms |
0 KB |
- |