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/1007
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
짝수인 N개의 점이 주어짐. 그 중 두 개씩 짝지어 벡터 집합을 형성함. 형성된 벡터 집합의 총 합의 최솟값을 출력. 점들은 한번 사용되면 사용될 수 없음.
🔍 풀이 방법
DFS, 점이 한번밖에 사용되지 못한다는 점 때문에 점들은 두 개씩 짝지어져 벡터를 만들고 짝지어진 경우 다른 것과는 벡터를 형성할 수 없음. 따라서 이 문제는 출발점 N/2개의 그룹, 도착점 N/2개의 그룹 두 개로 나뉠 수 있음. 벡터 하나는 도착점-출발점으로 구하는데 벡터집합의 모든 합을 구하는 것이므로 그냥 도착점 다 합한거에서 출발점 다 합한거를 뺐을 때 얻어지는 벡터의 크기를 구하면 된다. 출발점과 도착점을 구하는 건 DFS로 처음부터 가면서 현재 지점이 출발점인지 아닌지만 구별
⏳ 회고
벡터를 구하는 것보다 N개중에 N/2개를 고르는 알고리즘이 어려웠음..