이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "cyberland.h"
using namespace std;
#define lim 100005
#define OYY INT_MAX
#define fi first
#define se second
int n,m,k,h;
int vis[lim],dist[lim];
vector<pair<int,int>> v[lim];
inline int dij(int node){
for(int i=0;i<n;i++){
vis[i]=0;
dist[i]=OYY;
}
priority_queue<pair<int,int>> pq;
pq.push({0,0}); // cur distance --- cur node
dist[0]=0;
while(!pq.empty()){
int node=pq.top().se;
pq.pop();
if(vis[node])continue;
vis[node]=1;
for(auto go:v[node]){
if(dist[node]+go.se<dist[go.fi]){
dist[go.fi]=dist[node]+go.se;
pq.push({-dist[go.fi],go.fi});
}
}
}
return dist[h];
}
double solve(int N, int M, int K, int H,vector<int> x,vector<int> y,vector<int> c,vector<int> arr) {
n=N;m=M;k=K;h=H;
for(int i=0;i<m;i++){
v[x[i]].push_back({y[i],c[i]});
v[y[i]].push_back({x[i],c[i]});
}
int cev=dij(0);
for(int i=0;i<n;i++){
v[i].clear();
}
return cev;
}
# | 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... |