アルゴリズム

【自分用メモ】Union-Find木

Union-Find木のコード 参考書 プログラミングコンテストチャレンジブック [第2版] Union-Find木とは… ・グループ分けを管理するデータ構造 ・根が同じ場合同じグループとする #include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #inclu</set></queue></cmath></map></iostream></cstdio></algorithm>…

【自分用メモ】ダイクストラ法

ダイクストラ法のコード ダイクストラ法とは… グラフのある頂点から他の頂点への最短距離を求めるときの方法 参考書 プログラミングコンテストチャレンジブック [第2版] ダイクストラ法 - Wikipediaのgifがわかりやすい #include <algorithm> #include <cstdio> #include <iostream> #incl</iostream></cstdio></algorithm>…