이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pll pair<int, int>
#define fs first
#define sc second
#define pb push_back
double solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> v) {
vector<vector<pll>> g(n);
for (int i = 0; i < m; i++) {
int a = x[i], b = y[i], cost = c[i];
g[a].pb({b, cost});
g[b].pb({a, cost});
}
vector<int> dist(n, 1e9 + 10);
dist[0] = 0;
priority_queue<pll, vector<pll>, greater<pll>> q;
q.push({0, 0});
while (!q.empty()) {
auto [curcost, v] = q.top();
q.pop();
if (curcost != dist[v]) continue;
for (auto [to, cost] : g[v]) {
if (dist[to] > dist[v] + cost) {
dist[to] = dist[v] + cost;
q.push({dist[to], to});
}
}
}
return dist[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... |