RT
在 dfs 里面记忆化的 flag 或 temp 变量不要设为全局变量。
dfs
flag
temp
void dfs(ll x,ll cnt,ll top){ ll flag=0; if(val[x]==1){ s[++top]=x; // return ; } //(后略) }