版本比较
题解:P1916 Hermite 多点求值 / 多点 Taylor 展开
正文
增加 6 行删除 6 行
201 行未改动全部展开20220320420520620720820620720820921021121239 行未改动25225325425525625625725825926026126126226326426521 行未改动28728828929029129129229329429510 行未改动201 行未改动全部展开 { int mid = (l + r) / 2; build_segment_tree(2 * node, l, mid); build_segment_tree(2 * node + 1, mid + 1, r); seg_tree[node] = multiply(seg_tree[2 * static_cast<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>::size_type>(node)], seg_tree[2 * static_cast<std::vector<std::vector<int, std::allocator<int>>, seg_tree[node] = multiply(seg_tree[2 * static_cast<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>::size_type>(node)], seg_tree[2 * static_cast<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>::size_type>(node) + 1]); }}
39 行未改动 else { int mid = (l + r) / 2; // 计算左子树的余式 vector<int> rem_left = poly_mod(rem, seg_tree[2 * static_cast<std::vector<std::vector<int, std::allocator<int>>, vector<int> rem_left = poly_mod(rem, seg_tree[2 * static_cast<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>::size_type>(node)]); solve(2 * node, l, mid, rem_left);
// 计算右子树的余式 vector<int> rem_right = poly_mod(rem, seg_tree[2 * static_cast<std::vector<std::vector<int, std::allocator<int>>, vector<int> rem_right = poly_mod(rem, seg_tree[2 * static_cast<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>::size_type>(node) + 1]); solve(2 * node + 1, mid + 1, r, rem_right); }}21 行未改动 // 预处理阶乘 precompute_factorials(max(n, max_k));
// 初始化线段树 seg_tree.reserve(4 * static_cast<std::vector<std::vector<int, std::allocator<int>>, seg_tree.reserve(4 * static_cast<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>::size_type>(m)); // 预留空间 build_segment_tree(1, 0, m - 1);
// 求解所有查询10 行未改动