-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
최소 공통 조상(LCA) Lowest Common Ancestor #13
Comments
추천 문제
|
3176번 도로 네트워크
|
LCA와 쿼리 (15480 )
일단 임의의 루트로 두고 lca를 구하는 sparse table을 만들어 놓고 r, u, v,에 대한 정답은(r, u) / (r, v) / (u, v) 의 lca들의 depth들 중 가장 큰 값!! LCA와 쿼리 2 ( 13511 )
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lowest Common Ancestor
가장 가까운 위치의 공통 조상을 찾는데 쓰이거나 두 노드의 가장 가까운 거리를 찾는데 사용
LCA
시나리오
2-1) 부모노드로 계속 한칸씩 끌어올리면서 깊이를 확인 / 두 노드가 같은 깊이 상태까지
3-1) 두 노드가 같아질때가 최소 공통 조상
LCA2
DP를 이용하여 해결
시나리오
LCA2 를 이용한 정점들간의 거리
==> dist[cur] = dist[parent] + cost
출처 링크 : https://www.crocus.co.kr/660
The text was updated successfully, but these errors were encountered: