이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "cyberland.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, int> pdi;
#define fi first
#define se second
#define mp make_pair
const int N = (int)1e5 + 10;
const int K = 65;
vector<pii> T[N];
int A[N];
double d[N];
bool vis[N];
double solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) {
k = min(k, 60);
for(int i = 0 ; i < n; i ++ ){
T[i].clear();
A[i] = arr[i];
d[i] = 1e18;
vis[i] = false;
}
for(int i = 0 ; i < m ; i ++ ){
T[x[i]].push_back(mp(y[i], c[i]));
T[y[i]].push_back(mp(x[i], c[i]));
}
double sol = 1e18;
priority_queue<pdi, vector<pdi>, greater<pdi>> pq;
d[h] = 0.0;
pq.push(mp(0.0, h));
int node;
double res;
while(!pq.empty()){
node = pq.top().se;
res = pq.top().fi;
pq.pop();
if(vis[node]) continue;
if(node == 0 || A[node] == 0) sol = min(sol, res);
for(auto x : T[node]){
if(d[x.fi] > d[node] + x.se){
d[x.fi] = d[node] + x.se;
pq.push(mp(d[x.fi], x.fi));
}
}
}
return sol;
}
# | 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... |