이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//we are all lost trying to be someone.
#include <bits/stdc++.h>
#include "cyberland.h"
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define sz(x) ll(x.size())
#define reve(x) reverse(x.begin(),x.end())
#define ff first
#define ss second
using namespace std;
typedef int ll;
typedef long double ld;
typedef pair<ll,ll> ii;
const ll MAX=(1e5+10)*2;
vector<ll> gfo[MAX];
bool vst[MAX];
double dist[MAX];
map<ii,double>A;
void bfs(ll ini){
queue<ll> q;
q.push(ini);
vst[ini]=true;
dist[ini]=0.0;
while(sz(q)){
ll u=q.front();
q.pop();
for(ll v:gfo[u]){
if(!vst[v]){
vst[v]=true;
dist[v]=dist[u]+A[{u,v}];
q.push(v);
}
}
}
}
double solve(ll N, ll M, ll K,ll H, vector<ll> x, vector<ll> y, vector<ll> c, vector<ll> arr){
for(ll i=0; i<=N; i++){
dist[i]=-1.0;
}
for(ll i=0; i<M; i++){
gfo[x[i]].push_back(y[i]);
gfo[y[i]].push_back(x[i]);
A[{x[i],y[i]}]=c[i];
A[{y[i],x[i]}]=c[i];
}
bfs(0);
return dist[H];
}
# | 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... |