题解-序列终结者

题解-序列终结者

这是模板,所有平衡树的题差不多都是模板。

参考资料

暂无

大纲

题解-序列终结者
Introduction \texttt{Introduction} Introduction
Description \texttt{Description} Description
Solution \texttt{Solution} Solution
Code \texttt{Code} Code


Introduction \color{#000}\texttt{Introduction} Introduction

蒟蒻初学平衡树一日,做此题耗时五,虽错不奇,记此文以典为人,以堑为己。


Description \color{#000}\texttt{Description} Description

序列终结者
有一个 N N N 个数的序列 a 1 , a 2 , . . . , a n a_1,a_2,...,a_n a1,a2,...,an 刚开始时都为 0 0 0,有 M M M 个操作如下:

  1. [ L , R ] [L,R] [L,R] 这个区间内的所有数加上 V V V
  2. [ L , R ] [L,R] [L,R] 这个区间翻转,比如 1 , 2 , 3 , 4 1,2,3,4 1,2,3,4 变成 4 , 3 , 2 , 1 4,3,2,1 4,3,2,1
  3. [ L , R ] [L,R] [L,R] 这个区间中的最大值。
    数据范围: 1 ≤ N ≤ 5 × 1 0 4 1\le N\le 5\times 10^4 1N5×104 1 ≤ M ≤ 1 0 5 1\le M\le 10^5 1M105

Solution \color{#000}\texttt{Solution} Solution

区间翻转操作就说明要用 Splaytree \texttt{Splaytree} Splaytree 了(速学平衡树)。用结构体 ( n o d e ) { d , v } (node)\{d,v\} (

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值