[백준] 1197번 최소 스패닝 트리
n, m = map(int, input().split()) edges = [] parent = [0] * (n+1) def find_parent(x): if parent[x] != x: parent[x] = find_parent(parent[x]) return parent[x] def union_node(a, b): a = find_parent(a) b = find_parent(b) if a < b: parent[b] = a else: parent[a] = b for i in range(1, n+1): parent[i] = i for _ in range(m): a, b, c = map(int, input().split()) edges.append((a, b, c)) edges = sorted(edges,..
코딩테스트 대비
2022. 3. 8. 19:45
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 코딩테스트
- pytorch
- 이것이코딩테스트다
- 백트래킹
- Python
- docker
- PIP
- CUDA
- 카카오
- 다익스트라
- 백준
- 설치하기
- LGSVL
- 최소신장트리
- n과m
- matplotlib
- shellscript
- tensorflow
- numpy
- 동적프로그래밍
- error
- torchscript
- version
- 설치
- BFS
- 프로그래머스
- 파이썬
- dfs
- torch
- notfound
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함