Conversation
timepresent95
approved these changes
Aug 30, 2024
Collaborator
timepresent95
left a comment
There was a problem hiding this comment.
전형적인 문제들이 많아서 풀이가 다 비슷하긴하지만
그 안에서 사용하는 문법들은 여전히 달라서 보는 즐거움이 있네요 ㅎㅎ
이번 주차도 고생 많으셨습니다!
Comment on lines
+3
to
+8
| N, *edges = map(int, open(0).read().split()) # edges = [1, 6, 6, 3, ...] | ||
| tree = [[] for _ in range(N + 1)] | ||
|
|
||
| for a, b in zip(edges[::2], edges[1::2]): # 2씩 건너뛰며 zip [1, 6], [6, 3], ... | ||
| tree[a] += [b] # 연결된 노드 리스트 저장 | ||
| tree[b] += [a] |
Collaborator
There was a problem hiding this comment.
zip을 활용하는 방법이 정말 파이썬 스럽고 좋네요 ㅎㅎ
| from itertools import permutations, starmap | ||
|
|
||
| # open(0) : 표준 입력 받아오기 | ||
| NM, nums = [*open(0)] # NM = "3 1\n", nums = "4 4 2\n" |
Collaborator
There was a problem hiding this comment.
한줄씩 값을 받아올때 정말 편하겠네요
좋은거 하나 알아갑니다!
HanMulBit
approved these changes
Sep 1, 2024
Collaborator
HanMulBit
left a comment
There was a problem hiding this comment.
평소에 *을 잘 안쓰게 되었었는데 쓰는 방법 많이 배운 것 같아요
이번 주차도 고생많으셨어요!
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.
close #38