Skip to content

Conversation

@lkhyun
Copy link
Contributor

@lkhyun lkhyun commented May 5, 2025

🧷 문제 링크

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

🧭 풀이 시간

60분

👀 체감 난이도

✏️ 문제 설명

트리에 대한 정보가 주어짐. 트리에서 두 개의 특정 노드를 잡고 늘렸을 때 그 직선 거리의 최댓값 구하기

🔍 풀이 방법

BFS

⏳ 회고

원래는 N이 10000이고 그 중 2개를 뽑는 것이 가능하니까 리프 노드들을 모두 모아서 combination 하는 방식으로 진행했는데 올바르게 나오기는 하는데 메모리 초과가 발생했음. 결국 특정 노드에서 BFS를 진행하고 가장 먼 노드에서 다시 BFS를 진행하여 얻는 노드가 가장 멀리 있는 노드 쌍이라는 것을 알게 되었음. 메모리 초과 나는 거 오랜만인듯..

@lkhyun lkhyun added the hint 💡 반례를 참고했거나 힌트를 얻고 풀었을 때 label May 5, 2025
@lkhyun lkhyun self-assigned this May 5, 2025
@ShinHeeEul ShinHeeEul merged commit cf15a21 into main May 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