This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cyberland.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using node = pair<int, ll>;
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) {
for(int x: arr) assert(x == 1);
vector<vector<node>> g(N);
vector<ll> h(N, 1e18);
for(int i = 0; i < M; ++i){
g[x[i]].emplace_back(y[i], c[i]);
g[y[i]].emplace_back(x[i], c[i]);
}
priority_queue<node, vector<node>, greater<node>> b;
b.emplace(0, 0);
while(!b.empty()){
auto [u, cur] = b.top();
b.pop();
if(h[u] <= cur) continue;
h[u] = cur;
for(auto [v, w]: g[u])
b.emplace(v, w+cur);
}
return h[H];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |