![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线段树
m悟空
这个作者很懒,什么都没留下…
展开
-
A Simple Problem with Integers (线段树模板)
You haveNintegers,A1,A2, ... ,AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the ...原创 2019-04-10 19:07:20 · 187 阅读 · 0 评论 -
维护序列(线段树,区间加,区间乘)
题目描述原题来自:AHOI 2009老师交给小可可一个维护数列的任务,现在小可可希望你来帮他完成。有长为的数列,不妨设为。有如下三种操作形式:把数列中的一段数全部乘一个值; 把数列中的一段数全部加一个值; 询问数列中的一段数的和,由于答案可能很大,你只需输出这个数模 P的值。输入格式第一行两个整数 n和 P;第二行含有 n个非负整数,从左到右依次为 ai ;...原创 2019-05-20 12:34:35 · 634 阅读 · 0 评论 -
花神游历各国(线段树,区间开平方)
题目描述原题来自:BZOJ 3211花神喜欢步行游历各国,顺便虐爆各地竞赛。花神有一条游览路线,它是线型的,也就是说,所有游历国家呈一条线的形状排列,花神对每个国家都有一个喜欢程度(当然花神并不一定喜欢所有国家)。每一次旅行中,花神会选择一条旅游路线,它在那一串国家中是连续的一段,这次旅行带来的开心值是这些国家的喜欢度的总和,当然花神对这些国家的喜欢程序并不是恒定的,有时会突然对某些国...原创 2019-05-20 12:45:56 · 417 阅读 · 0 评论 -
Aragorn's Story(树链剖分+线段树或树状数组模板)
Our protagonist is the handsome human prince Aragorn comes from The Lord of the Rings. One day Aragorn finds a lot of enemies who want to invade his kingdom. As Aragorn knows, the enemy has N camps ou...原创 2019-05-28 21:51:32 · 941 阅读 · 0 评论 -
求和问题(线段树维护等差数列)
题目描述你现在有一个数组AA我们定义如下的两种操作:1. 修改: 形如00llrr,效果为对所有l<=i<=rl<=i<=r执行Ai+=(i−l+1)Ai+=(i−l+1)直观地说就是Al+=1,Al+1+=2,Al+2+=3...Ar+=r−l+1Al+=1,Al+1+=2,Al+2+=3...Ar+=r−l+1这个样子2. ...原创 2019-08-02 22:41:57 · 546 阅读 · 0 评论 -
Rikka with Cake(线段树求线段之间的交点个数)
Rikka's birthday is on June 12th. The story of this problem happens on that day.Today is Rikka's birthday. Yuta prepares a big cake for her: the shape of this cake is a rectangular ofnncentimeters...原创 2019-08-20 20:04:36 · 284 阅读 · 0 评论 -
Hello 2019 (线段树维护矩阵实现任意区间的dp)
A digital string is "good": when it contains a subsequence91029102and does not contain a subsequence81028102.The bad value of a string is defined as how many characters are to remove at least, so...原创 2019-09-14 09:37:58 · 379 阅读 · 0 评论