死循环求助!!大佬们帮忙看看吧!!

P5018 [NOIP2018 普及组] 对称二叉树

@[Andy_2006](/user/261262) `check`函数没判断是否有节点 $l,r$?
by Houraisan_Kaguya @ 2020-02-26 19:02:15


@[Andy_2006](/user/261262) Line16: `if(a[now].left!=-1)` Line21: `if(a[now].right!=-1)`
by Houraisan_Kaguya @ 2020-02-26 19:09:11


@[Andy_2006](/user/261262) - Line29: `if(l==-1&&r==-1)` - Line33: `else if(l!=-1&&r!=-1&&a[l].value==a[r].value&&check(a[l].left,a[r].right)&&check(a[l].right,a[r].left))`
by Houraisan_Kaguya @ 2020-02-26 19:10:50


Line33: `else if(l!=-1&&r!=-1...`(剩下都对)
by Houraisan_Kaguya @ 2020-02-26 19:11:41


以上行号可能有点错位,意会吧@[Andy_2006](/user/261262)
by Houraisan_Kaguya @ 2020-02-26 19:13:23


这样就可以过样例了
by Houraisan_Kaguya @ 2020-02-26 19:13:47


谢谢 我看看
by WaltVBAlston @ 2020-02-26 19:45:26


|