Skip to content

Conversation

@03do-new30
Copy link
Contributor

🧷 문제 링크

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

🧭 풀이 시간

40분

👀 체감 난이도

✏️ 문제 설명

"적은 에너지 방법" 으로 채워진 K진 트리에서 두 노드 x와 y 사이의 거리를 구하자

🔍 풀이 방법

  • x와 y 사이의 거리는 depth 기반으로 구한다.
    • x와 y가 같은 정점에서 만날 때까지 각각 부모 노드를 타고 올라온다고 생각하면 편함
  • K = 1일 때(worst)는 x와 y의 차를 리턴하면 된다

⏳ 회고

  • 0번 노드부터 쓴다고 생각하면 부모 노드 구하는 공식이 조금 더 잘 보이는 느낌 🤔

@03do-new30 03do-new30 added the hint 💡 반례를 참고했거나 힌트를 얻고 풀었을 때 label Mar 5, 2025
@ShinHeeEul ShinHeeEul merged commit db48f59 into main Mar 5, 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.

3 participants