Skip to content

Conversation

@ShinHeeEul
Copy link
Contributor

🧷 문제 링크

https://www.acmicpc.net/problem/15480

🧭 풀이 시간

40 분

👀 체감 난이도

✏️ 문제 설명

N개의 정점으로 이루어져 있는 트리 T가 주어졌을 때, 다음 쿼리를 수행하는 프로그램을 작성하시오.
r u v: T의 루트가 r이라고 했을 때, u와 v의 LCA를 출력한다.

🔍 풀이 방법

LCA를 3번 하고 그 중 depth를 제일 긴 값을 찾으면 된다.

⏳ 회고

전에 한번 풀이법을 봤어서 까먹고 풀고 싶었는데.. 너무 강렬해서 잊혀지지가 않는다.

@ShinHeeEul ShinHeeEul added the hint 💡 반례를 참고했거나 힌트를 얻고 풀었을 때 label Mar 13, 2025
@ShinHeeEul ShinHeeEul self-assigned this Mar 13, 2025
@ShinHeeEul ShinHeeEul merged commit 8a24745 into main Mar 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hint 💡 반례를 참고했거나 힌트를 얻고 풀었을 때

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants