求大佬找下错。
#include<iostream>
#include<cstdio>
#include<queue>
#define maxn 200001
#define maxm 500005
using namespace std;
int n,m,s,t,g,p;
int cnt;
bool flag[maxn];
int hi[maxn],mi[maxm],li[maxn];
int fir[maxm],d[maxn],vis[maxn];
struct bal{
int next=-1;
int to;
int w;
};
bal e[maxm];
queue <int> q;
void add(int x,int y,int z){
e[++cnt].next=fir[x];
e[cnt].to=y;
e[cnt].w=z;
fir[x]=cnt;
}
inline int re()
{
int x=0,f=1;char ch=getchar();
while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
void spfa()
{
for(int i=1;i<=n;i++)d[i]=(1<<30);
queue<int>q;
q.push(s);
d[s]=0;
vis[s]=1;
while(!q.empty())
{
int u=q.front();
q.pop();
vis[u]=0;
for(int i=fir[u];i!=-1;i=e[i].next)
{
int v=e[i].to;
if(!flag[v]&&d[v]>d[u]+e[i].w)
{
if(hi[v]+(d[u]+e[i].w)*p<=li[v]||v==t)
{
d[v]==d[u]+e[i].w;
if(!vis[v])
{
vis[v]=1;
q.push(v);
}
}
}
}
}
}
int main()
{
n=re();m=re();s=re();
t=re();g=re();p=re();
for(int i=1;i<=n;i++){
hi[i]=re();li[i]=re();
if(hi[i]==li[i])
flag[i]=1;
}
for(int i=1;i<=m;i++){
int a,b,c;
a=re();b=re(); c=re();
add(a,b,c);add(b,a,c);
}
spfa();
if(d[t]>g)
cout<<"wtnap wa kotori no oyatsu desu!";
else cout<<d[t]<<endl;
return 0;
}