求助!!!
哪位dalao能帮我看看哪里出问题了 最后一点wa
#include<bits/stdc++.h>
using namespace std;
int n,m;
int ans[1000005];
const int inf=100003;
struct Edge{
int to,nxt;
}edge[1000005];
struct node{
int priority;
int v;
bool operator>(const node& e)const{
return e.priority<priority;
}
};
int dist[1000005];
bool vis[1000005];
priority_queue<node,vector<node>,greater<node>> pq;
int head[1000005];
int cnt;
void addnode(int u,int v){
edge[++cnt].to=v;
edge[cnt].nxt=head[u];
head[u]=cnt;
}
void dijikstra(int s){
memset(dist,0x3f,sizeof(dist));
pq.push({0,s});
dist[s]=0;
ans[s]=1;
while(!pq.empty()){
node tmp=pq.top();
pq.pop();
if(tmp.priority!=dist[tmp.v]){
continue;
}
// if(vis[tmp.v]) continue;
// vis[tmp.v]=1;
for(int i=head[tmp.v];i;i=edge[i].nxt){
if(dist[edge[i].to]>dist[tmp.v]+1){
dist[edge[i].to]=dist[tmp.v]+1;
pq.push({dist[edge[i].to],edge[i].to});
ans[edge[i].to]=ans[tmp.v];
ans[edge[i].to]%=inf;
}
else if(dist[edge[i].to]==dist[tmp.v]+1){
ans[edge[i].to]=(ans[edge[i].to]+ans[tmp.v])%inf;
}
}
}
}
int main(){
cin>>n>>m;
for(int i=1;i<=m;i++){
int u,v;
cin>>u>>v;
addnode(u,v);
addnode(v,u);
}
dijikstra(1);
for(int i=1;i<=n;i++){
cout<<ans[i]<<endl;
}
return 0;
}