이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int> > G[100005];
double rez=0;
int N;
void dijkstra(int kraj) {
bool vis[N]={0};
double dist[N];
for (int i=0;i<N;i++)
dist[i]=1e15;
priority_queue<pair<double,int> > pq;
pq.push({0,0});
dist[0]=0;
while (!pq.empty()) {
int teme=pq.top().second;
pq.pop();
if (vis[teme]) continue;
vis[teme]=1;
for (auto x:G[teme]) {
int next=x.first, dist_between=x.second;
if (dist[next]>dist[teme]+dist_between) {
dist[next]=dist[teme]+dist_between;
pq.push({-dist[next], next});
}
}
}
rez=dist[kraj];
}
double solve(int n, int m, int k, int h, vector<int> a, vector<int> b, vector<int> c, vector<int> arr) {
for(int i=0;i<n;i++)
G[i].clear();
N=n;
for (int i=0;i<m;i++) {
G[a[i]].push_back({b[i],c[i]});
G[b[i]].push_back({a[i],c[i]});
}
dijkstra(h);
return rez;
}
# | 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... |