Skip to content

Commit

Permalink
size_t -> std::size_t
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo314 committed Aug 12, 2024
1 parent a521b75 commit d541c3c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cpp/rerooting-dp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @brief 全方位木DP
*/
#include <algorithm>
#include <cstddef>
#include <type_traits>
#include "tree.hpp"

Expand Down Expand Up @@ -40,12 +41,12 @@ std::vector<V> rerooting_dp(const Tree<Cost>& tree, E e, Merge merge, AddEdge ad
for (int u : rooted.preorder) {
const auto& ch = rooted.child[u];
std::vector<E> ri(ch.size() + 1, e);
for (size_t i = ch.size(); i > 0; i--) {
for (std::size_t i = ch.size(); i > 0; i--) {
ri[i - 1] = merge(ri[i], addedge(subdp[ch[i - 1].dst], ch[i - 1].cost, ch[i - 1].id));
}
dp[u] = addnode(merge(pe[u], ri[0]), u);
E le = pe[u];
for (size_t i = 0; i < ch.size(); i++) {
for (std::size_t i = 0; i < ch.size(); i++) {
pe[ch[i].dst] = addedge(addnode(merge(le, ri[i + 1]), u), ch[i].cost, ch[i].id);
le = merge(le, addedge(subdp[ch[i].dst], ch[i].cost, ch[i].id));
}
Expand Down

0 comments on commit d541c3c

Please sign in to comment.