网络赛前10奖励计蒜客的本子或鼠标垫(外校也可以来现场领取)
Xidian Online Judge WebBoard
[ New Thread ]
Problem 1104 >> 怀疑数据里面有环,或者有其它不合法的情况
Alice @ 2017-04-18 16:01:53
[ Quote ] [ Edit ] [ Delete ] 1#
int ans;
void dfs(int u,int p) {
++ans;
for(int i=head[u];i!=-1;i=e[i].next) {
if(e[i].v==p) continue;
dfs(e[i].v,u);
}
}
这个dfs竟然会报运行错误
void dfs(int u,int p) {
++ans;
vis[u]=1;
for(int i=head[u];i!=-1;i=e[i].next) {
if(e[i].v==p) continue;
if(vis[e[i].v]) continue;
dfs(e[i].v,u);
}
}
然后如果我给每个点加了个vis访问标记就变成wa了
worse @ 2017-04-29 16:41:00
[ Quote ] [ Edit ] [ Delete ] 2#
It seems the input has some cycle(s).
See submittion 84596 and 84597.
adminlight @ 2017-04-29 16:43:40
[ Quote ] [ Edit ] [ Delete ] 3#
Confirmed. Found an edge duplicated in the input.
adminlight @ 2017-04-29 16:46:57
[ Quote ] [ Edit ] [ Delete ] 4#
The input has been corrected. Rejudging.
adminlight @ 2017-04-29 16:47:47
[ Quote ] [ Edit ] [ Delete ] 5#
Rejudge complete.
[Top] [Previous Page] [Next Page]
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2014 Xidian ACM Online Judge TEAM
GPL2.0 2003-2014 HUSTOJ Project TEAM