Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:一直wa的注意看下,两点相同的时候就不用改了

Posted by runan2021 at 2024-02-11 19:54:15 on Problem 2763
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator