이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "cyberland.h"
using namespace std;
// #define int long long
#define ff first
#define ss second
const int shrek = 1e5 + 10;
// vector< vector<pair<int, int>>> adj(shrek);
vector<pair<int, int>> adj[shrek];
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);
for(int i = 0; i < n; i++)
adj[i].clear();
for(int i = 0; i < n; i++) dist[i] = -1;
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>> q;
q.push({0.0, 0});
while(!q.empty()) {
double d = -q.top().ff;
int u = q.top().ss;
q.pop();
if(dist[u] != -1) continue;
dist[u] = d;
for(auto x : adj[u]) {
int v = x.ff;
double w = x.ss;
q.push({-(d + w), v});
}
}
double ans = dist[h];
return ans;
}
# | 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... |