你把 0x7f 改成 0x3f 试试
by NaCly_Fish @ 2019-01-13 18:54:08
@[NaCly_Fish](/space/show?uid=115864) 没用哇,还是那三个点[评测记录](https://www.luogu.org/recordnew/show/15382407)
by Timing @ 2019-01-13 18:56:57
~~又是你~~
by ezoixx130 @ 2019-01-13 19:45:55
in数组似乎没清零。。
by _xqy_ @ 2019-01-13 19:50:03
@[ezoixx130](/space/show?uid=34886) ???
by Timing @ 2019-01-14 21:48:46
@[_xqy_](/space/show?uid=111317) 清零后多A了三个
by Timing @ 2019-01-14 21:54:53
```cpp
#include<bits/stdc++.h>
#define re register
using namespace std;
const int M=500050;
const int N=100005;
int head[N],to[M],cnt,nxt[M],w[M],tot[M];
queue<int> q;
int n,m,s;
void add(int u,int v,int val){
to[++cnt]=v;
nxt[cnt]=head[u];
w[cnt]=val;
head[u]=cnt;
}
int dis[N],vis[N],in[N];
inline int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=(x<<1)+(x<<3)+(ch^48);
ch=getchar();
}
return x*f;
}
bool spfa(){
memset(dis,0x3f,sizeof(dis));
memset(vis,0,sizeof(vis));
dis[1]=0;
q.push(1);
vis[1]=1;
tot[1]=1;
while(q.size()){
int u=q.front();
q.pop();
vis[u]=0;
for(int i=head[u];i;i=nxt[i]){
int v=to[i];
if(dis[u]+w[i]<dis[v]){
dis[v]=dis[u]+w[i];
tot[v]=tot[u]+1;
if(tot[v]>n)return 1;
if(!vis[v]){
q.push(v);
vis[v]=1;
}
}
}
}return 0;
}
int main(){
int T;
T=read();
while(T--){
n=read();m=read();
// memset(tot,0,sizeof(tot));
memset(head,0,sizeof(head));
cnt=0;
for(re int i=1;i<=m;++i){
int x,y,z;
x=read();y=read();z=read();
if(z>0){
add(x,y,z);
add(y,x,z);
}
else add(x,y,z);
}
if(spfa()){
cout<<"YE5"<<endl;
}
else cout<<"N0"<<endl;
}
return 0;
}
```
by Timing @ 2019-01-14 22:00:43
发现输入数据时输不全,开头会被截掉一大段,这是咋了
by Timing @ 2019-01-14 22:07:43