Skip to content

Commit 41af68b

Browse files
authored
Merge pull request #347 from hitonanode/rename-potentialized-unionfind
WeightedUnionFind -> PotentializedUnionFind
2 parents a933c94 + 172ba6c commit 41af68b

5 files changed

+15
-15
lines changed

unionfind/weighted_unionfind.hpp renamed to unionfind/potentialized_unionfind.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
#include <utility>
44
#include <vector>
55

6-
// CUT begin
7-
// Weighted UnionFind
8-
template <class S> struct WeightedUnionFind {
6+
// Potentialized UnionFind (Weighted UnionFind)
7+
template <class S> struct PotentializedUnionFind {
98
std::vector<int> par, sz;
109
std::vector<S> pot;
11-
WeightedUnionFind(int N = 0) : par(N), sz(N, 1), pot(N) {
10+
PotentializedUnionFind(int N = 0) : par(N), sz(N, 1), pot(N) {
1211
std::iota(par.begin(), par.end(), 0);
1312
}
1413
int find(int x) {
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Weighted UnionFind (重み付き UnionFind)
3-
documentation_of: ./weighted_unionfind.hpp
2+
title: Potentialized UnionFind (重み付き UnionFind)
3+
documentation_of: ./potentialized_unionfind.hpp
44
---
55

66
2個の要素間の重みづけが可能な UnionFind.
@@ -10,7 +10,7 @@ documentation_of: ./weighted_unionfind.hpp
1010
ポテンシャルが(ふつうの)整数の場合.
1111

1212
```cpp
13-
WeightedUnionFind<int> uf(N);
13+
PotentializedUnionFind<int> uf(N);
1414
uf.unite(s, t, diff); // f[t] = f[s] + diff を要請.これまでの要請と矛盾すれば false を返す.
1515

1616
auto x = uf.diff(s, t); // f[t] - f[s] (として考えられる値の一つ)を出力.
@@ -19,9 +19,10 @@ auto x = uf.diff(s, t); // f[t] - f[s] (として考えられる値の一つ
1919
ポテンシャルが $\mathbb{F}_{2}$ 上のベクトルの場合.
2020
2121
```cpp
22-
WeightedUnionFind<Nimber> uf(N);
22+
PotentializedUnionFind<Nimber> uf(N);
2323
```
2424

2525
## 問題例
2626

2727
- [No.1420 国勢調査 (Easy) - yukicoder](https://yukicoder.me/problems/no/1420) $\mathbb{F}_2$ 上のベクトル.
28+
- [AtCoder Beginner Contest 373 D - Hidden Weights](https://atcoder.jp/contests/abc373/tasks/abc373_d)

unionfind/test/weighted_unionfind.test.cpp renamed to unionfind/test/potentialized_unionfind.test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#include "../weighted_unionfind.hpp"
1+
#include "../potentialized_unionfind.hpp"
22
#include <iostream>
33
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_1_B&lang=jp"
44
using namespace std;
55

66
int main() {
77
int N, Q, x, y, z;
88
cin >> N >> Q;
9-
WeightedUnionFind<int> uf(N);
9+
PotentializedUnionFind<int> uf(N);
1010
for (int i = 0; i < Q; i++) {
1111
int c;
1212
cin >> c;

unionfind/test/weighted_unionfind_F2.yuki1420.test.cpp renamed to unionfind/test/potentialized_unionfind_F2.yuki1420.test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#define PROBLEM "https://yukicoder.me/problems/no/1420"
22
#define ERROR 1 // Check only whether the answer is -1 or not
33
#include "../../number/nimber.hpp"
4-
#include "../weighted_unionfind.hpp"
4+
#include "../potentialized_unionfind.hpp"
55
#include <iostream>
66
using namespace std;
77

@@ -10,7 +10,7 @@ int main() {
1010
int N, M;
1111
cin >> N >> M;
1212

13-
WeightedUnionFind<Nimber> uf(N);
13+
PotentializedUnionFind<Nimber> uf(N);
1414
while (M--) {
1515
int a, b, y;
1616
cin >> a >> b >> y;

unionfind/test/weighted_unionfind_int.aoj3142.test.cpp renamed to unionfind/test/potentialized_unionfind_int.aoj3142.test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define PROBLEM "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=3142"
2-
#include "../weighted_unionfind.hpp"
2+
#include "../potentialized_unionfind.hpp"
33
#include <algorithm>
44
#include <iostream>
55
#include <vector>
@@ -8,7 +8,7 @@ using namespace std;
88
int N;
99
vector<vector<int>> to;
1010
vector<int> A, B;
11-
WeightedUnionFind<long long> uf;
11+
PotentializedUnionFind<long long> uf;
1212

1313
long long dfs(int now, int prv) {
1414
long long acc = B[now] - A[now];
@@ -26,7 +26,7 @@ int main() {
2626
cin.tie(nullptr), ios::sync_with_stdio(false);
2727

2828
cin >> N;
29-
uf = WeightedUnionFind<long long>(N);
29+
uf = PotentializedUnionFind<long long>(N);
3030
to.resize(N);
3131

3232
for (int e = 0; e < N - 1; e++) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy