线段树板子汇总

题单介绍

## 各种线段树模板汇总 欢迎提供更多。 以下对所有题目进行分类整理,按照顺序排在题单里。 ### 最基础的线段树模板 [P3372](https://www.luogu.com.cn/problem/P3372) 线段树入门 ### 线段树维护区间最值 [P1531](https://www.luogu.com.cn/problem/P1531) [P1816](https://www.luogu.com.cn/problem/P1816) 求区间最值 [P3130](https://www.luogu.com.cn/problem/P4438) 区间最小值+区间和 ### 异或/01线段树 [P2574](https://www.luogu.com.cn/problem/P2574) 更新时全异或 1 [P2846](https://www.luogu.com.cn/problem/P2846) 双倍经验 [P3870](https://www.luogu.com.cn/problem/P3870) 三倍经验 [SP7259](https://www.luogu.com.cn/problem/SP7259) 四倍经验 [P5057](https://www.luogu.com.cn/problem/P5057) ### 线段树维护区间最大子段和 [SP1043](https://www.luogu.com.cn/problem/SP1043) [SP1716](https://www.luogu.com.cn/problem/SP1716) 前面基础上加个单点修改 [P4513](https://www.luogu.com.cn/problem/P4513) 双倍经验 ### 线段树区间开方修改 [SP2713](https://www.luogu.com.cn/problem/SP2713) [P4145](https://www.luogu.com.cn/problem/P4145) 双倍经验 ### 线段树同时维护区间加和乘 [P3373](https://www.luogu.com.cn/problem/P3373) 模板 2 [P2023](https://www.luogu.com.cn/problem/P2023) 双倍经验 ### 线段树维护区间最大公约数 [P10463](https://www.luogu.com.cn/problem/P10463) ### 线段树维护区间平方和 [P1471](https://www.luogu.com.cn/problem/P1471) [P2122](https://www.luogu.com.cn/problem/P2122) 双倍经验 [P5142](https://www.luogu.com.cn/problem/P5142) 三倍经验 ### 其它变形 [P1438](https://www.luogu.com.cn/problem/P5874) 区间加等差数列 [P1253](https://www.luogu.com.cn/problem/P1253) 同时维护区间加和最值 [P4588](https://www.luogu.com.cn/problem/P4588) 按照时间轴建立线段树 [P1558](https://www.luogu.com.cn/problem/P1558) 状态压缩 ~~你甚至可以建 30 棵线段树~~ [P6472](https://www.luogu.com.cn/problem/P6472) 找01交错区间 [P5874](https://www.luogu.com.cn/problem/P5874) 前缀累乘 乘法转对数加 [P2894](https://www.luogu.com.cn/problem/P2894) 找连续的 0 **[P2572](https://www.luogu.com.cn/problem/P2572) 超级无敌爆炸霹雳旋转毒瘤题,许多思想的大杂烩** [P2221](https://www.luogu.com.cn/problem/P2221) 推公式并维护三种区间和

题目列表

  • 【模板】线段树 1
  • I Hate It
  • 忠诚
  • [USACO15DEC] Counting Haybale P
  • XOR的艺术
  • [USACO08NOV] Light Switching G
  • [TJOI2009] 开关
  • LITE - Light Switching
  • [CQOI2006] 简单题
  • GSS1 - Can you answer these queries I
  • GSS3 - Can you answer these queries III
  • 小白逛公园
  • GSS4 - Can you answer these queries IV
  • 上帝造题的七分钟 2 / 花神游历各国
  • 【模板】线段树 2
  • [AHOI2009] 维护序列
  • Interval GCD
  • 方差
  • 还教室
  • 区间方差
  • 无聊的数列
  • 扶苏的问题
  • [TJOI2018] 数学计算
  • 色板游戏
  • [COCI 2010/2011 #6] STEP
  • [IOI 2015] horses
  • [USACO08FEB] Hotel G
  • [SCOI2010] 序列操作
  • [HAOI2012] 高速公路
  • [yLOI2019] 棠梨煎雪
  • COmPoUNdS
  • [国家集训队] 等差子序列