Skip to content

Commit

Permalink
[auto-verifier] docs commit f31a486
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow authored Mar 17, 2024
1 parent d6724b1 commit c122909
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 32 deletions.
4 changes: 4 additions & 0 deletions DataStructure/DSU/DisjointSet.h.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ data:
- icon: ':heavy_check_mark:'
path: Graph/tests/aizu_grl_2_a_mst.test.cpp
title: Graph/tests/aizu_grl_2_a_mst.test.cpp
- icon: ':heavy_check_mark:'
path: Graph/tests/yosupo_mst.test.cpp
title: Graph/tests/yosupo_mst.test.cpp
_isVerificationFailed: false
_pathExtension: h
_verificationStatusIcon: ':heavy_check_mark:'
Expand Down Expand Up @@ -47,6 +50,7 @@ data:
verifiedWith:
- DataStructure/test/aizu_dsl_1_a_dsu.test.cpp
- DataStructure/test/dsu.test.cpp
- Graph/tests/yosupo_mst.test.cpp
- Graph/tests/aizu_grl_2_a_mst.test.cpp
documentation_of: DataStructure/DSU/DisjointSet.h
layout: document
Expand Down
42 changes: 23 additions & 19 deletions Graph/mst.h.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ data:
- icon: ':heavy_check_mark:'
path: Graph/tests/aizu_grl_2_a_mst.test.cpp
title: Graph/tests/aizu_grl_2_a_mst.test.cpp
- icon: ':heavy_check_mark:'
path: Graph/tests/yosupo_mst.test.cpp
title: Graph/tests/yosupo_mst.test.cpp
_isVerificationFailed: false
_pathExtension: h
_verificationStatusIcon: ':heavy_check_mark:'
Expand All @@ -25,36 +28,37 @@ data:
\ lab[v] = u;\n return true;\n }\n\n bool same_component(int u, int\
\ v) {\n return getRoot(u) == getRoot(v);\n }\n\n int component_size(int\
\ u) {\n return -lab[getRoot(u)];\n }\n};\n// }}}\n#line 9 \"Graph/mst.h\"\
\n\n// MST {{{\nusing ll = long long;\nstruct Edge {\n int u, v;\n ll c;\n\
};\nbool operator < (const Edge& a, const Edge& b) {\n return a.c < b.c;\n\
}\nostream& operator << (ostream& out, const Edge& e) {\n out << e.u << \"\
\ - \" << e.v << \" [\" << e.c << ']';\n return out;\n}\nstd::pair<ll, std::vector<Edge>>\
\ mst(\n int n,\n std::vector<Edge> edges) {\n std::sort(edges.begin(),\
\ edges.end());\n\n DSU dsu(n + 1); // tolerate 1-based index\n ll total\
\ = 0;\n vector<Edge> tree;\n for (const auto& e : edges) {\n const\
\ auto [u, v, c] = e;\n if (dsu.merge(u, v)) {\n total += c;\n\
\n\n// MST {{{\nusing ll = long long;\ntemplate<typename EdgeT>\nstd::pair<ll,\
\ std::vector<EdgeT>> mst(\n int n,\n std::vector<EdgeT> edges)\
\ {\n std::sort(edges.begin(), edges.end());\n\n DSU dsu(n + 1); // tolerate\
\ 1-based index\n ll total = 0;\n vector<EdgeT> tree;\n for (const auto&\
\ e : edges) {\n if (dsu.merge(e.u, e.v)) {\n total += e.c;\n\
\ tree.push_back(e);\n }\n }\n return {total, tree};\n\
}\n// }}}\n"
}\nstruct Edge {\n int u, v;\n ll c;\n};\nbool operator < (const Edge& a,\
\ const Edge& b) {\n return a.c < b.c;\n}\nostream& operator << (ostream& out,\
\ const Edge& e) {\n out << e.u << \" - \" << e.v << \" [\" << e.c << ']';\n\
\ return out;\n}\n// }}}\n"
code: "// MST. 0-based index\n//\n// Returns:\n// {mst cost, edges in mst}\n//\n\
// If graph is not connected, returns forest (number of edges will be < n-1)\n\
\n#include \"../DataStructure/DSU/DisjointSet.h\"\n\n// MST {{{\nusing ll = long\
\ long;\nstruct Edge {\n int u, v;\n ll c;\n};\nbool operator < (const Edge&\
\ a, const Edge& b) {\n return a.c < b.c;\n}\nostream& operator << (ostream&\
\ out, const Edge& e) {\n out << e.u << \" - \" << e.v << \" [\" << e.c <<\
\ ']';\n return out;\n}\nstd::pair<ll, std::vector<Edge>> mst(\n int\
\ n,\n std::vector<Edge> edges) {\n std::sort(edges.begin(), edges.end());\n\
\n DSU dsu(n + 1); // tolerate 1-based index\n ll total = 0;\n vector<Edge>\
\ tree;\n for (const auto& e : edges) {\n const auto [u, v, c] = e;\n\
\ if (dsu.merge(u, v)) {\n total += c;\n tree.push_back(e);\n\
\ }\n }\n return {total, tree};\n}\n// }}}\n"
\ long;\ntemplate<typename EdgeT>\nstd::pair<ll, std::vector<EdgeT>> mst(\n \
\ int n,\n std::vector<EdgeT> edges) {\n std::sort(edges.begin(),\
\ edges.end());\n\n DSU dsu(n + 1); // tolerate 1-based index\n ll total\
\ = 0;\n vector<EdgeT> tree;\n for (const auto& e : edges) {\n if\
\ (dsu.merge(e.u, e.v)) {\n total += e.c;\n tree.push_back(e);\n\
\ }\n }\n return {total, tree};\n}\nstruct Edge {\n int u, v;\n\
\ ll c;\n};\nbool operator < (const Edge& a, const Edge& b) {\n return a.c\
\ < b.c;\n}\nostream& operator << (ostream& out, const Edge& e) {\n out <<\
\ e.u << \" - \" << e.v << \" [\" << e.c << ']';\n return out;\n}\n// }}}\n"
dependsOn:
- DataStructure/DSU/DisjointSet.h
isVerificationFile: false
path: Graph/mst.h
requiredBy: []
timestamp: '2023-01-07 01:46:12+08:00'
timestamp: '2024-03-17 02:51:32+00:00'
verificationStatus: LIBRARY_ALL_AC
verifiedWith:
- Graph/tests/yosupo_mst.test.cpp
- Graph/tests/aizu_grl_2_a_mst.test.cpp
documentation_of: Graph/mst.h
layout: document
Expand Down
26 changes: 13 additions & 13 deletions Graph/tests/aizu_grl_2_a_mst.test.cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ data:
\ lab[v] = u;\n return true;\n }\n\n bool same_component(int u, int\
\ v) {\n return getRoot(u) == getRoot(v);\n }\n\n int component_size(int\
\ u) {\n return -lab[getRoot(u)];\n }\n};\n// }}}\n#line 9 \"Graph/mst.h\"\
\n\n// MST {{{\nusing ll = long long;\nstruct Edge {\n int u, v;\n ll c;\n\
};\nbool operator < (const Edge& a, const Edge& b) {\n return a.c < b.c;\n\
}\nostream& operator << (ostream& out, const Edge& e) {\n out << e.u << \"\
\ - \" << e.v << \" [\" << e.c << ']';\n return out;\n}\nstd::pair<ll, std::vector<Edge>>\
\ mst(\n int n,\n std::vector<Edge> edges) {\n std::sort(edges.begin(),\
\ edges.end());\n\n DSU dsu(n + 1); // tolerate 1-based index\n ll total\
\ = 0;\n vector<Edge> tree;\n for (const auto& e : edges) {\n const\
\ auto [u, v, c] = e;\n if (dsu.merge(u, v)) {\n total += c;\n\
\n\n// MST {{{\nusing ll = long long;\ntemplate<typename EdgeT>\nstd::pair<ll,\
\ std::vector<EdgeT>> mst(\n int n,\n std::vector<EdgeT> edges)\
\ {\n std::sort(edges.begin(), edges.end());\n\n DSU dsu(n + 1); // tolerate\
\ 1-based index\n ll total = 0;\n vector<EdgeT> tree;\n for (const auto&\
\ e : edges) {\n if (dsu.merge(e.u, e.v)) {\n total += e.c;\n\
\ tree.push_back(e);\n }\n }\n return {total, tree};\n\
}\n// }}}\n#line 5 \"Graph/tests/aizu_grl_2_a_mst.test.cpp\"\n\nvoid solve() {\n\
\ int n, m; cin >> n >> m;\n vector<Edge> edges(m);\n for (auto& [u,\
\ v, c] : edges) cin >> u >> v >> c;\n\n cout << mst(n, edges).first << endl;\n\
}\n"
}\nstruct Edge {\n int u, v;\n ll c;\n};\nbool operator < (const Edge& a,\
\ const Edge& b) {\n return a.c < b.c;\n}\nostream& operator << (ostream& out,\
\ const Edge& e) {\n out << e.u << \" - \" << e.v << \" [\" << e.c << ']';\n\
\ return out;\n}\n// }}}\n#line 5 \"Graph/tests/aizu_grl_2_a_mst.test.cpp\"\
\n\nvoid solve() {\n int n, m; cin >> n >> m;\n vector<Edge> edges(m);\n\
\ for (auto& [u, v, c] : edges) cin >> u >> v >> c;\n\n cout << mst(n, edges).first\
\ << endl;\n}\n"
code: "#define PROBLEM \"https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_2_A\"\
\n\n#include \"../../template.h\"\n#include \"../mst.h\"\n\nvoid solve() {\n \
\ int n, m; cin >> n >> m;\n vector<Edge> edges(m);\n for (auto& [u, v,\
Expand All @@ -83,7 +83,7 @@ data:
isVerificationFile: true
path: Graph/tests/aizu_grl_2_a_mst.test.cpp
requiredBy: []
timestamp: '2023-01-07 01:46:12+08:00'
timestamp: '2024-03-17 02:51:32+00:00'
verificationStatus: TEST_ACCEPTED
verifiedWith: []
documentation_of: Graph/tests/aizu_grl_2_a_mst.test.cpp
Expand Down
98 changes: 98 additions & 0 deletions Graph/tests/yosupo_mst.test.cpp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
data:
_extendedDependsOn:
- icon: ':heavy_check_mark:'
path: DataStructure/DSU/DisjointSet.h
title: DataStructure/DSU/DisjointSet.h
- icon: ':heavy_check_mark:'
path: Graph/mst.h
title: Graph/mst.h
- icon: ':heavy_check_mark:'
path: template.h
title: template.h
_extendedRequiredBy: []
_extendedVerifiedWith: []
_isVerificationFailed: false
_pathExtension: cpp
_verificationStatusIcon: ':heavy_check_mark:'
attributes:
'*NOT_SPECIAL_COMMENTS*': ''
PROBLEM: https://judge.yosupo.jp/problem/minimum_spanning_tree
links:
- https://judge.yosupo.jp/problem/minimum_spanning_tree
bundledCode: "#line 1 \"Graph/tests/yosupo_mst.test.cpp\"\n#define PROBLEM \"https://judge.yosupo.jp/problem/minimum_spanning_tree\"\
\n\n#line 1 \"template.h\"\n#include <bits/stdc++.h>\nusing namespace std;\n\n\
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)\n#define FORD(i,a,b) for(int\
\ i=(a),_b=(b); i>=_b; i--)\n#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)\n\
#define EACH(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)\n\
\n#define DEBUG(x) { cout << #x << \" = \"; cout << (x) << endl; }\n#define PR(a,n)\
\ { cout << #a << \" = \"; FOR(_,1,n) cout << a[_] << ' '; cout << endl; }\n#define\
\ PR0(a,n) { cout << #a << \" = \"; REP(_,n) cout << a[_] << ' '; cout << endl;\
\ }\n\n#define sqr(x) ((x) * (x))\n\n// For printing pair, container, etc.\n//\
\ Copied from https://quangloc99.github.io/2021/07/30/my-CP-debugging-template.html\n\
template<class U, class V> ostream& operator << (ostream& out, const pair<U, V>&\
\ p) {\n return out << '(' << p.first << \", \" << p.second << ')';\n}\n\n\
template<class Con, class = decltype(begin(declval<Con>()))>\ntypename enable_if<!is_same<Con,\
\ string>::value, ostream&>::type\noperator << (ostream& out, const Con& con)\
\ {\n out << '{';\n for (auto beg = con.begin(), it = beg; it != con.end();\
\ it++) {\n out << (it == beg ? \"\" : \", \") << *it;\n }\n return\
\ out << '}';\n}\ntemplate<size_t i, class T> ostream& print_tuple_utils(ostream&\
\ out, const T& tup) {\n if constexpr(i == tuple_size<T>::value) return out\
\ << \")\"; \n else return print_tuple_utils<i + 1, T>(out << (i ? \", \" :\
\ \"(\") << get<i>(tup), tup); \n}\ntemplate<class ...U> ostream& operator <<\
\ (ostream& out, const tuple<U...>& t) {\n return print_tuple_utils<0, tuple<U...>>(out,\
\ t);\n}\n\nmt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());\n\
long long get_rand(long long r) {\n return uniform_int_distribution<long long>\
\ (0, r-1)(rng);\n}\n\ntemplate<typename T>\nvector<T> read_vector(int n) {\n\
\ vector<T> res(n);\n for (int& x : res) cin >> x;\n return res;\n}\n\
\nvoid solve();\n\nint main() {\n ios::sync_with_stdio(0); cin.tie(0);\n \
\ solve();\n return 0;\n}\n#line 1 \"Graph/mst.h\"\n// MST. 0-based index\n\
//\n// Returns:\n// {mst cost, edges in mst}\n//\n// If graph is not connected,\
\ returns forest (number of edges will be < n-1)\n\n#line 1 \"DataStructure/DSU/DisjointSet.h\"\
\n// DisjointSet {{{\nstruct DSU {\n vector<int> lab;\n\n DSU(int n) : lab(n+1,\
\ -1) {}\n\n int getRoot(int u) {\n if (lab[u] < 0) return u;\n \
\ return lab[u] = getRoot(lab[u]);\n }\n\n bool merge(int u, int v) {\n\
\ u = getRoot(u); v = getRoot(v);\n if (u == v) return false;\n\
\ if (lab[u] > lab[v]) swap(u, v);\n lab[u] += lab[v];\n \
\ lab[v] = u;\n return true;\n }\n\n bool same_component(int u, int\
\ v) {\n return getRoot(u) == getRoot(v);\n }\n\n int component_size(int\
\ u) {\n return -lab[getRoot(u)];\n }\n};\n// }}}\n#line 9 \"Graph/mst.h\"\
\n\n// MST {{{\nusing ll = long long;\ntemplate<typename EdgeT>\nstd::pair<ll,\
\ std::vector<EdgeT>> mst(\n int n,\n std::vector<EdgeT> edges)\
\ {\n std::sort(edges.begin(), edges.end());\n\n DSU dsu(n + 1); // tolerate\
\ 1-based index\n ll total = 0;\n vector<EdgeT> tree;\n for (const auto&\
\ e : edges) {\n if (dsu.merge(e.u, e.v)) {\n total += e.c;\n\
\ tree.push_back(e);\n }\n }\n return {total, tree};\n\
}\nstruct Edge {\n int u, v;\n ll c;\n};\nbool operator < (const Edge& a,\
\ const Edge& b) {\n return a.c < b.c;\n}\nostream& operator << (ostream& out,\
\ const Edge& e) {\n out << e.u << \" - \" << e.v << \" [\" << e.c << ']';\n\
\ return out;\n}\n// }}}\n#line 5 \"Graph/tests/yosupo_mst.test.cpp\"\n\nstruct\
\ E : Edge {\n int id;\n};\n\nvoid solve() {\n int n, m; cin >> n >> m;\n\
\ vector<E> edges(m);\n REP(i,m) {\n auto& e = edges[i];\n \
\ cin >> e.u >> e.v >> e.c;\n e.id = i;\n }\n auto g = mst<E>(n,\
\ edges);\n cout << g.first << '\\n';\n for (auto& e : g.second) cout <<\
\ e.id << ' ';\n cout << '\\n';\n}\n"
code: "#define PROBLEM \"https://judge.yosupo.jp/problem/minimum_spanning_tree\"\
\n\n#include \"../../template.h\"\n#include \"../mst.h\"\n\nstruct E : Edge {\n\
\ int id;\n};\n\nvoid solve() {\n int n, m; cin >> n >> m;\n vector<E>\
\ edges(m);\n REP(i,m) {\n auto& e = edges[i];\n cin >> e.u >>\
\ e.v >> e.c;\n e.id = i;\n }\n auto g = mst<E>(n, edges);\n cout\
\ << g.first << '\\n';\n for (auto& e : g.second) cout << e.id << ' ';\n \
\ cout << '\\n';\n}\n"
dependsOn:
- template.h
- Graph/mst.h
- DataStructure/DSU/DisjointSet.h
isVerificationFile: true
path: Graph/tests/yosupo_mst.test.cpp
requiredBy: []
timestamp: '2024-03-17 02:51:32+00:00'
verificationStatus: TEST_ACCEPTED
verifiedWith: []
documentation_of: Graph/tests/yosupo_mst.test.cpp
layout: document
redirect_from:
- /verify/Graph/tests/yosupo_mst.test.cpp
- /verify/Graph/tests/yosupo_mst.test.cpp.html
title: Graph/tests/yosupo_mst.test.cpp
---
3 changes: 3 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,9 @@ data:
- icon: ':heavy_check_mark:'
path: Graph/tests/two_sat.test.cpp
title: Graph/tests/two_sat.test.cpp
- icon: ':heavy_check_mark:'
path: Graph/tests/yosupo_mst.test.cpp
title: Graph/tests/yosupo_mst.test.cpp
- name: Math/tests
pages:
- icon: ':heavy_check_mark:'
Expand Down
4 changes: 4 additions & 0 deletions template.h.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ data:
- icon: ':heavy_check_mark:'
path: Graph/tests/aizu_grl_5_a_tree_diameter.test.cpp
title: Graph/tests/aizu_grl_5_a_tree_diameter.test.cpp
- icon: ':heavy_check_mark:'
path: Graph/tests/yosupo_mst.test.cpp
title: Graph/tests/yosupo_mst.test.cpp
- icon: ':heavy_check_mark:'
path: Math/tests/aizu_ntl_1_a_factorize.test.cpp
title: Math/tests/aizu_ntl_1_a_factorize.test.cpp
Expand Down Expand Up @@ -404,6 +407,7 @@ data:
- DP/tests/aizu_alds1_5_d_count_inversions.test.cpp
- Graph/tests/aizu_grl_4_a_strongly_connected_cycle_check.test.cpp
- Graph/tests/aizu_grl_3_a_articulation_points.test.cpp
- Graph/tests/yosupo_mst.test.cpp
- Graph/tests/aizu_grl_5_a_tree_diameter.test.cpp
- Graph/tests/aizu_grl_2_a_mst.test.cpp
- Graph/tests/aizu_grl_1_c_floyd.test.cpp
Expand Down

0 comments on commit c122909

Please sign in to comment.