# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
869360 | vjudge1 | Commuter Pass (JOI18_commuter_pass) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define ll long long int
const int mxn=1e5+5;
ll n,m,dis[mxn],s,t,u,v,ans=1e18,mark[mxn];
pair<int,int>par2[mxn];
vector<int>par[mxn];
set<pair<ll,ll> >st,yal[mxn];
void dfs(int z){
mark[z]=1;
dis[z]=0;
for(auto i:par[z]){
if(!mark[i]){
dfs(i);
}
}
}
void dij(){
while(st.size()){
auto x=*st.begin();
st.erase({x.fr,x.sc});
for(auto i:yal[x.sc]){
if(dis[i.fr]>x.fr+i.sc){
st.erase({dis[i.fr],i.fr});
dis[i.fr]=x.fr+i.sc;
st.insert({dis[i.fr],i.fr});
par2[i.fr].fr=x.sc;
par2[i.fr].sc=i.sc;