티스토리 뷰
반응형
Difficulty : 4/10
I couln't solve this problem during the contest.
but It is not a difficult probelm.
this problem can be solved in various way. I solved it with "union find algorithm". because union find is good algorithms to express "disjoint set".
but the problem has a constraint. It is a "all station has just two degree, Just in and out".
so it can be solved with just loop using parent, visit array.
these two problem solving has different time complexity each other. second one is faster and use less memory. but when express disjoint set, union find is common one.
union find
Source:
loop
Source:
반응형
'알고리즘 문제 > DFS and Simillar' 카테고리의 다른 글
백준 12784 인하니카 공화국 (0) | 2018.05.29 |
---|---|
백준 2447 별찍기10 (0) | 2018.03.06 |
BoJ 1717 : 집합의 표현 (0) | 2017.10.29 |
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 아레나 시뮬레이션
- 그라파나
- 최단경로 알고리즘
- Simulation
- 자바스크립트 예제
- 데이터 중심 애플리케이션 설계
- Propositional and Predicate Logic
- Trie
- 백준
- 자바스크립트
- rosen
- 가상 면접 사례로 배우는 대규모 시스템 설계 기초
- flutter
- 로젠
- 이산수학
- 대규모 시스템 설계 기초
- 이산 수학
- 아레나
- arena simulation
- 명제논리
- 엄청난 인내심과 시뮬레이션을 위한 아레나 툴
- grafana cloud
- Arena
- Discrete Mathematics
- beginning javascript
- 항해99
- 아레나시뮬레이션
- javascript
- 시뮬레이션
- paul wilton
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함