Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- scc
- Shortest path
- bitmask
- BOJ
- Greedy
- GCD
- CS Academy
- graph modeling
- flows
- implementation
- POJ
- Euler circuit
- Sieve_of_Eratosthenes
- disjoint-set
- Dag
- graph
- BFSDFS
- 백준
- backtracking
- Segment Tree
- BST
- Euler path
- Eulerian path
- DynamicProgramming
- Algospot
- dynamic programming
- Eulerian circuit
- mathematics
- hashing
- Cycle detecting
Archives
- Today
- Total
목록DSU (1)
그냥 하는 노트와 메모장
DSU(Disjoint-set union) 문제들
* DSU (Disjoint-Set Union, Union-Find 또는 상호배제 집합) DSU에 관련된 문제 중 푼 문제를 소개합니당 1. Codeforce 1-1. Serial Time! (http://codeforces.com/contest/60/problem/B) 단순히 BFS 돌려도 되지만, DSU로 풀어보고 싶어서 적용해봤다. 인접한 6 이웃에 대해 #이 아니라면 접근이 가능하다. 코드 : #include int tp[10][10][10], p[1001], s[1001]; int find(int u) { if (u == p[u]) return u; return p[u] = find(p[u]); } void merge(int u, int v) { u = find(u), v = find(v); i..
Algorithms
2018. 5. 17. 15:29