正文
增加 17 行删除 1 行
12 行未改动131415161718192021399 行未改动全部展开421422423424425426427428519 行未改动全部展开12 行未改动---$\mathrm{2026.7.8}$:提交全站推荐。$\mathrm{2026.7.22}$:修复一些代码上的疏漏(第 $k$ 大异或和与线性基求并);修改排版;新增题目 [P14994 异或最短路和](https://www.luogu.com.cn/problem/P14994) 和 [P15044 [UOI 2022 II Stage] 树](https://www.luogu.com.cn/problem/P15044)。$\mathrm{2026.7.26}$:感谢 @[ZHR100102](https://www.luogu.com.cn/user/947153) 对于线性基求交的勘误。麻烦善良的管理员请通过一下。399 行未改动全部展开::::---### [P4151 [WC2011] 最大 XOR 和路径](https://www.luogu.com.cn/problem/P4151) / [CF845G Shortest Path Problem?](https://www.luogu.com.cn/problem/CF845G)给定一张 $n$ 个点 $m$ 条边的带权无向连通图,求 $1$ 号点到 $n$ 号点的(非简单)路径异或和最大 / 小值。519 行未改动全部展开12 行未改动131415161718192021399 行未改动全部展开421422423424425426427428429430431432433434435436437438439440441442443444519 行未改动全部展开12 行未改动---$\mathrm{2026.7.8}$:提交全站推荐。$\mathrm{2026.7.22}$:修复一些代码上的疏漏(第 $k$ 大异或和与线性基求并);修改排版;新增题目 [P14994 异或最短路和](https://www.luogu.com.cn/problem/P14994),[P15044 [UOI 2022 II Stage] 树](https://www.luogu.com.cn/problem/P15044),[P17127 [ICPC 2025 Shanghai R] Gemcrate](https://www.luogu.com.cn/problem/P17127)。$\mathrm{2026.7.26}$:感谢 @[ZHR100102](https://www.luogu.com.cn/user/947153) 对于线性基求交的勘误。麻烦善良的管理员请通过一下。399 行未改动全部展开::::---### [P17127 [ICPC 2025 Shanghai R] Gemcrate](https://www.luogu.com.cn/problem/P17127)$n$ 个数 $a_i$,进行分组,最大化每组异或和的按位与和。$n\leq5\times10^5,V\leq2^{60}$。---显然至多分两组,否则三组合并成一组结果不变。记 $\oplus_{i=1}^na_i=s$。分一组结果为 $s$,分两组则结果为 $x\&(x\oplus s)$,考虑将 $a_i$ 与上 $s$ 取反的结果加入线性基求一个最大值。时间复杂度 $O(n\log V)$。---### [P4151 [WC2011] 最大 XOR 和路径](https://www.luogu.com.cn/problem/P4151) / [CF845G Shortest Path Problem?](https://www.luogu.com.cn/problem/CF845G)给定一张 $n$ 个点 $m$ 条边的带权无向连通图,求 $1$ 号点到 $n$ 号点的(非简单)路径异或和最大 / 小值。519 行未改动全部展开