```cpp
#include<cstdio>
#include<iostream>
#include<iomanip>
#include<string>
#include<cstring>
#include<queue>
#include<map>
#include<algorithm>
#include<vector>
#include<ctime>
#include<cmath>
//include<黄一嵘>
using namespace std;
int n,m,d,head[200],len,pre[200][510][2],maxv;
double dis[200][510];
struct Edge
{
int x,next,v,l;
}edge[40010];
bool check[200];
queue<int> que;
void print(int pos,int spe)
{
if(pos==0)
{
cout<<0<<' ';
return;
}
print(pre[pos][spe][0],pre[pos][spe][1]);
cout<<pos<<' ';
}
int main()
{
maxv=70;
cin>>n>>m>>d;
for(int i=1;i<=m;i++)
{
int a,b,v,l;
scanf("%d%d%d%d",&a,&b,&v,&l);
maxv=max(maxv,v);
edge[++len].x=b;
edge[len].v=v;
edge[len].l=l;
edge[len].next=head[a];
head[a]=len;
}
memset(dis,127,sizeof(dis));
dis[0][70]=0;
check[0]=1;
que.push(0);
while(!que.empty())
{
bool tag=0;
for(int i=head[que.front()];i;i=edge[i].next)
{
tag=0;
if(!edge[i].v)
{
for(int j=1;j<=maxv;j++)
if(dis[edge[i].x][j]>dis[que.front()][j]+(double)edge[i].l/j
&&dis[que.front()][j]!=dis[0][0])
{
tag=1;
dis[edge[i].x][j]=dis[que.front()][j]+(double)edge[i].l/j;
pre[edge[i].x][j][0]=que.front();
pre[edge[i].x][j][1]=j;
}
}
else
{
int temp=0;
for(int j=1;j<=maxv;j++)
if(dis[que.front()][j]<dis[que.front()][temp])
temp=j;
if(dis[edge[i].x][edge[i].v]>dis[que.front()][temp]+
(double)edge[i].l/edge[i].v&&dis[que.front()][temp]!=dis[0][0])
{
dis[edge[i].x][edge[i].v]=dis[que.front()][temp]+(double)edge[i].l/edge[i].v;
tag=1;
pre[edge[i].x][edge[i].v][0]=que.front();
pre[edge[i].x][edge[i].v][1]=temp;
}
}
if(tag&&!check[edge[i].x])
{//cout<<edge[i].x<<' ';
check[edge[i].x]=1;
que.push(edge[i].x);
}
}
check[que.front()]=0;
que.pop();
}
int ans=0;
for(int i=1;i<=maxv;i++)
if(dis[d][i]<dis[d][ans])
ans=i;
print(d,ans);
return 0;
}
```
by hyr1357 @ 2018-05-05 20:47:56
@[hyr1357](/space/show?uid=55748) 输得出来啊。。。我刚刚用洛谷IDE试了一下。。。
by 1124828077ccj @ 2018-05-05 20:57:59
@[陈常杰](/space/show?uid=14738) 用我的编译器输不出来。。。。
by hyr1357 @ 2018-05-05 21:22:35