이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define ll long long
#define ff first
#define ss second
#define pint pair < int , int >
#define vint vector < int >
#define fast ios_base::sync_with_stdio(NULL); cin.tie(NULL)
const int inf = 1e9 + 9;
const int mxn = 2e5 + 2;
const int mod = 1e9 + 7;
vector < vector < pint > > adj(mxn);
int dis[mxn];
double solve(int n , int m , int k , int H , vint x , vint y , vint c , vint arr) {
for (int i = 0; i < n; i++) {
adj[i].clear();
dis[i] = inf;
}
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 < pint > q;
q.push({0 , 0});
while (!q.empty()) {
pint p = q.top();
q.pop();
dis[p.ss] = -p.ff;
if (p.ss == H) return dis[H];
for (pint i : adj[p.ss]) {
if (dis[i.ff] != inf) continue;
q.push({p.ff - i.ss , i.ff});
}
}
return -1;
}
# | 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... |