当前位置:网站首页>【学习笔记】线段树选做
【学习笔记】线段树选做
2022-07-07 10:59:00 【仰望星空的蚂蚁】
全是暴力
打线段树好累
Fibonotci
一看这个线性递推关系显然是矩阵乘法
码码码 。。。
呼 。。写完了 。
Two Permutations
序列 hash ?
毋宁称之为线段树维护序列 hash 值的好题
类比 Permutation 。本质在于将复杂状态用一个整数表示,这样复杂度更优 。
Strange Addition
显然线段树维护 dp 。
注意细节 。以及不要算重 。
如果实现精细的话可以不用去前导零。轻微卡常。
Strange Array
膜拜 wicton 。
这题做法没那么明显 。
考虑从 [i,i] 进行扩展
分区间奇偶性讨论
考虑一个 < a i <a_i <ai 的数和 > a i >a_i >ai 的数会抵消
把 a i a_i ai 看成 < a i <a_i <ai 和 > a i >a_i >ai 两种情况考虑两次,这样不会出现相等的元素
将 ≤ a i \leq a_i ≤ai 的数看成 1 1 1 , > a i >a_i >ai 的数看成 − 1 -1 −1
分别向左右扩展 ,找最大子段和 a n s ans ans ,贡献为 ⌊ a n s − 1 2 ⌋ \lfloor\frac{ans-1}{2}\rfloor ⌊2ans−1⌋
将 ≥ a i \geq a_i ≥ai 的数看成 1 1 1 , < a i <a_i <ai 的数看成 − 1 -1 −1
分别向左右扩展 ,找最大子段和 a n s ans ans ,贡献为 ⌊ a n s 2 ⌋ \lfloor\frac{ans}{2}\rfloor ⌊2ans⌋
码码码 。。。
呼 。。写完了 。
Phoenix and Memory
行百里者,半九十 。
首先贪心求一组方案
如果要得到不同的序列的话,一定存在 ( i , j ) (i,j) (i,j) ( i ≠ j ) (i\ne j) (i=j)使得 l i ≤ a j ≤ r i l_i\leq a_j\leq r_i li≤aj≤ri 并且 l j ≤ a i ≤ r j l_j\leq a_i\leq r_j lj≤ai≤rj
感性理解的话,如果你在贪心的最优方案上换的越多,方案也就更劣 。
证明略了 。
边栏推荐
- Find ID value MySQL in string
- 飞桨EasyDL实操范例:工业零件划痕自动识别
- Leetcode skimming: binary tree 22 (minimum absolute difference of binary search tree)
- 初学XML
- Sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]
- Day-19 IO stream
- 事务的七种传播行为
- Sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]
- [learn microservice from 0] [01] what is microservice
- Practical example of propeller easydl: automatic scratch recognition of industrial parts
猜你喜欢
Image pixel read / write operation
Practical example of propeller easydl: automatic scratch recognition of industrial parts
云检测2020:用于高分辨率遥感图像中云检测的自注意力生成对抗网络Self-Attentive Generative Adversarial Network for Cloud Detection
Aosikang biological sprint scientific innovation board of Hillhouse Investment: annual revenue of 450million yuan, lost cooperation with kangxinuo
Adopt a cow to sprint A shares: it plans to raise 1.85 billion yuan, and Xu Xiaobo holds nearly 40%
基于NeRF的三维内容生成
人均瑞数系列,瑞数 4 代 JS 逆向分析
日本政企员工喝醉丢失46万信息U盘,公开道歉又透露密码规则
Lingyunguang of Dachen and Xiaomi investment is listed: the market value is 15.3 billion, and the machine is implanted into the eyes and brain
Sequoia China completed the new phase of $9billion fund raising
随机推荐
Talk about four cluster schemes of redis cache, and their advantages and disadvantages
Cmu15445 (fall 2019) project 2 - hash table details
visual stdio 2017关于opencv4.1的环境配置
有什么类方法或是函数可以查看某个项目的Laravel版本的?
《开源圆桌派》第十一期“冰与火之歌”——如何平衡开源与安全间的天然矛盾?
DHCP 动态主机设置协议 分析
Leetcode skimming: binary tree 22 (minimum absolute difference of binary search tree)
MySQL master-slave replication
【学习笔记】AGC010
环境配置篇
处理链中断后如何继续/子链出错removed from scheduling
Day-19 IO stream
Go语言学习笔记-结构体(Struct)
How to apply @transactional transaction annotation to perfection?
How to reset Google browser? Google Chrome restore default settings?
ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
MySQL importing SQL files and common commands
HZOJ #235. 递归实现指数型枚举
人均瑞数系列,瑞数 4 代 JS 逆向分析
[binary tree] delete points to form a forest