Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://www.acmicpc.net/problem/1967
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
트리에 대한 정보가 주어짐. 트리에서 두 개의 특정 노드를 잡고 늘렸을 때 그 직선 거리의 최댓값 구하기
🔍 풀이 방법
BFS
⏳ 회고
원래는 N이 10000이고 그 중 2개를 뽑는 것이 가능하니까 리프 노드들을 모두 모아서 combination 하는 방식으로 진행했는데 올바르게 나오기는 하는데 메모리 초과가 발생했음. 결국 특정 노드에서 BFS를 진행하고 가장 먼 노드에서 다시 BFS를 진행하여 얻는 노드가 가장 멀리 있는 노드 쌍이라는 것을 알게 되었음. 메모리 초과 나는 거 오랜만인듯..