Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:一直wa的注意看下,两点相同的时候就不用改了In Reply To:一直wa的注意看下,两点相同的时候就不用改了 Posted by:Kechan at 2017-07-20 12:15:09 > 如题,wa了一上午终于过了 > int queue(int u,int v){ > int ans=0; > while(top[u]!=top[v]){ > if(dep[top[u]]<dep[top[v]])swap(u,v); > ans+=tree_que(tree_root,1,n,in[top[u]],in[u]); > u=fat[top[u]]; > } > if(u==v)return ans;//!!!!!!!!! > if(dep[u]>dep[v])swap(u,v); > ans+=tree_que(tree_root,1,n,in[son[u]],in[v]); > return ans; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator