이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cyberland.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll inf = 1e16;
const int maxn=1e5+5;
// const double eps = 0.00000001;
int D[maxn];
vector<pair<int,ll>>E[maxn];
double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) {
for(int i = 0;i < N;i++) E[i].clear();
for(int i = 0;i < M;i++){
E[x[i]].push_back({y[i],c[i]});
E[y[i]].push_back({x[i],c[i]});
}
ll ans = inf;
priority_queue<pair<ll,int>>q;
vector<ll>dis(N,inf);
vector<bool>vis(N,0);
dis[H] = 0;
q.push({0,H});
while(!q.empty()){
int x = q.top().second;
if(vis[x]) continue;
vis[x] = 1;
for(auto i : E[x]){
if(dis[i.first] > dis[x] + i.second){
dis[i.first] = dis[x] + i.second;
q.push({-dis[i.first],i.first});
}
}
}
ans = dis[0];
for(int i = 0;i < N;i++) if(arr[i] == 0) ans = min(ans,dis[i]);
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... |