Skip to content

Commit

Permalink
feat: fn_0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiphereth-A committed Jan 11, 2024
1 parent f3159b7 commit ba18ca3
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/code/tree/diam.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ constexpr auto tree_diam(G const& tree) {

dfs(
tree, tree.root,
[](u32, u32) {},
[](u32, u32, T const& = 1) {},
fn_0,
fn_0,
[&](u32 to, u32 u, T const& w = 1) {
if (T _ = mdis[to] + w; _ > mdis[u]) {
mdis2[u] = mdis[u], midx2[u] = midx[u];
Expand All @@ -28,7 +28,7 @@ constexpr auto tree_diam(G const& tree) {
if (midx[u] == u) midx[u] = midx[to];
}
},
[](u32, u32) {});
fn_0);

u32 u = midx[0], v = midx2[0];
T d = mdis[0] + mdis2[0];
Expand Down
6 changes: 3 additions & 3 deletions src/code/tree/tree_hash_rooted.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ constexpr vec<u64> tree_hash_rooted(tree const &tr, Hash &&hasher) {
vec<u64> hash(tr.g.size(), OFFSET);
dfs(
tr, tr.root,
[](u32, u32) {},
[](u32, u32, u32 = 1) {},
fn_0,
fn_0,
[&](u32 to, u32 u, u32 = 1) {
hash[u] += hasher(hash[to]);
},
[](u32, u32) {});
fn_0);
return hash;
}

Expand Down
6 changes: 3 additions & 3 deletions src/code/tree/tree_sumvw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ constexpr vec<T> tree_sumvw(G const &tr, vec<T> const &v_weight) {
vec<T> sumvw = v_weight;
dfs(
tr, tr.root,
[](u32, u32) {},
[](u32, u32, u32 = 1) {},
fn_0,
fn_0,
[&](u32 to, u32 u, u32 = 1) {
sumvw[u] += sumvw[to];
},
[](u32, u32) {});
fn_0);
return sumvw;
}

Expand Down
2 changes: 2 additions & 0 deletions src/code/util/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ constexpr u32 operator""_u32(unsigned long long x) { return (u32)x; }
constexpr u64 operator""_u64(unsigned long long x) { return (u64)x; }
constexpr usz operator""_uz(unsigned long long x) { return (usz)x; }

inline const auto fn_0 = [](auto&&...) {};

#endif
2 changes: 1 addition & 1 deletion src/test_cpverifier/aizu/alds1_12_b.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int main() {
g.add_arc(u, v, c);
}
}
auto dis = tifa_libs::graph::dijkstra(g, 0, [](u32, u32) {});
auto dis = tifa_libs::graph::dijkstra(g, 0, fn_0);
for (u32 i = 0; i < n; ++i) std::cout << i << ' ' << dis[i] << '\n';
return 0;
}
2 changes: 1 addition & 1 deletion src/test_cpverifier/aizu/alds1_12_c.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ int main() {
g.add_arc(u, v, c);
}
}
auto dis = tifa_libs::graph::dijkstra(g, 0, [](u32, u32) {});
auto dis = tifa_libs::graph::dijkstra(g, 0, fn_0);
for (u32 i = 0; i < n; ++i) std::cout << i << ' ' << dis[i] << '\n';
return 0;
}
3 changes: 1 addition & 2 deletions src/test_cpverifier/aizu/grl_1_a.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ int main() {
g.add_arc(u, v, w);
}
constexpr u32 INF = std::numeric_limits<u32>::max() / 2 - 1;
auto d = tifa_libs::graph::dijkstra(
g, r, [](u32, u32) {}, INF);
auto d = tifa_libs::graph::dijkstra(g, r, fn_0, INF);
for (u32 i : d)
if (i == INF) std::cout << "INF\n";
else std::cout << i << '\n';
Expand Down
3 changes: 1 addition & 2 deletions src/test_cpverifier/aizu/grl_1_b.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ int main() {
g.add_arc(u, v, w);
}
constexpr i32 INF = std::numeric_limits<i32>::max() / 2 - 1;
auto d = tifa_libs::graph::bellman_ford(
g, r, [](u32, u32) {}, INF);
auto d = tifa_libs::graph::bellman_ford(g, r, fn_0, INF);
if (!d.has_value()) {
std::cout << "NEGATIVE CYCLE\n";
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
int main() {
u32 n, a, b;
tifa_libs::fin >> n >> a >> b;
auto prime = tifa_libs::math::lsieve(
n + 1, [](u32) {}, [](u32, u32) {}, [](u32, u32) {});
auto prime = tifa_libs::math::lsieve(n + 1, fn_0, fn_0, fn_0);
tifa_libs::fout << prime.size() << ' ' << (prime.size() + a - 1 - b) / a << '\n';
for (usz i = b; i < prime.size(); i += a) tifa_libs::fout << prime[i] << " \n"[i + a >= prime.size()];
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/test_tinplate/util/dlx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void solve() {
std::cin >> x;
maps[i][j] = x;
}
auto res = tifa_libs::util::DLX(maps).dance([](auto const&) {});
auto res = tifa_libs::util::DLX(maps).dance(fn_0);
if (res.has_value())
for (auto i : res.value()) std::cout << i << ' ';
else
Expand Down

0 comments on commit ba18ca3

Please sign in to comment.