希望更丰富的展现?使用Markdown
by Ceuveine @ 2018-10-11 20:26:10
用正常格式发代码。。。
你这发的有点难看啊。。。
by 561025p @ 2018-10-11 20:34:19
```cpp
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<deque>
using namespace std;
const int maxn=25010,maxm=62010;
int n,m,st,fi,cnt=0;
int head[maxn],ver[maxm],edge[maxm],next[maxm],d[maxn];
void add(int x,int y,int z)
{
ver[++cnt]=y;
edge[cnt]=z;
next[cnt]=head[x];
head[x]=cnt;
}
deque<int> q;
bool v[maxn];
void spfa()
{
for(int i=0;i<=n;i++)
{
d[i]=0x3f;
v[i]=false;
}
q.push_back(st);
d[st]=0;
v[st]=true;
while(!q.empty())
{
int x=q.front();
q.pop_front();
v[x]=false;
for(int i=head[x];i;i=next[i])
{
int y=ver[i],z=edge[i];
if(d[y]>d[x]+z)
{
d[y]=d[x]+z;
int k=q.front();
if(!v[y])
{
if(d[y]<d[k]) q.push_front(y);
q.push_back(y);
v[y]=true;
}
}
}
}
}
int main()
{
int x,y,z;
scanf("%d%d%d%d",&n,&m,&st,&fi);
for(int i=1;i<=m;i++)
{
scanf("%d%d%d",&x,&y,&z);
add(x,y,z);
add(y,x,z);
}
spfa();
printf("%d",d[fi]);
return 0;
}
```
by 561025p @ 2018-10-11 20:41:59
这是你的代码。。。。
有点闲。。。
by 561025p @ 2018-10-11 20:42:32
@[561025p](/space/show?uid=91296)
emmm....
不好意思我不懂为啥发出来是这样子
by xuanluo @ 2018-10-11 20:47:24
噢是我的d数组初始化太小了。。。
by xuanluo @ 2018-10-11 20:52:04
```cpp
by 561025p @ 2018-10-11 20:57:08
有个提交代码这个选项来着
by 561025p @ 2018-10-11 20:58:19
USACO输出样例过一个点(手动滑稽)
by LotR_FB @ 2019-01-30 19:43:49