• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

原题洛谷P3371

建边迪杰斯特拉找最短路

#includebits/stdc .h

使用命名空间标准

结构E //边

{

龙长五;

长长的下一个;

long long w;

} ed[500001];

龙多头[500001],acti

bool b[700000];//标记

龙龙d[700000];//权

long long n,m,s,mi=0x7ffffff

长长的美国国家标准(American National Standards的缩写)

long long v1,w1,u1;

void ae(long long u,long long v,long long w) //建边

{

阿克蒂

艾德行动.v=v

艾德行动.w=w

艾德行动.next=head

head=acti;

}

int main()

{

填充(d,d 70000,2147483647);//初始化

cinnms

for(long long I=1;I=m;我)

{

CIN v1 w1 u 1;

ae(v1,w1,u1);

}

长长的卷发;

cur=s;

d=0;

while(b[cur]==0)

{

mi=2147483647

b[cur]=1;

for(long long I=head[cur];我!=0;我=ed.下一个)

{

如果[我]死了.v]==0d[ed]I .弯曲的,弯曲的. w)//松弛过程

{

dd .v]=d[cur] ed.w;

}

}

for(long long I=1;I=n;我)

{

if(b==0 mid) //取最小

{

mi=d

cur=I;

}

}

}

for(long long I=1;I=n;我)

{

coutd" ";//输出

}

返回0;

}

Link to comment
Share on other sites