随笔分类 -  树状数组

摘要:BaoBao is a good student who loves reading, but compared with his huge bookshelf containing lots and lots of books, his reading desk, which can only h 阅读全文
posted @ 2020-03-30 14:35 cherish__lin 阅读(250) 评论(0) 推荐(0)
摘要:题目描述 对于序列A,它的逆序对数定义为满足i<j,且Ai>Aj的数对(i,j)的个数。给1到n的一个排列,按照某种顺序依次删除m个元素,你的任务是在每次删除一个元素之前统计整个序列的逆序对数。 输入格式 输入第一行包含两个整数n和m,即初始元素的个数和删除的元素个数。以下n行每行包含一个1到n之间 阅读全文
posted @ 2019-11-30 20:25 cherish__lin 阅读(188) 评论(0) 推荐(0)
摘要:题目背景 这是一道模板题 可以使用bitset,CDQ分治,K-DTree等方式解决。 题目描述 有 nn 个元素,第 ii 个元素有 a_iai​、b_ibi​、c_ici​ 三个属性,设 f(i)f(i) 表示满足 a_j \leq a_iaj​≤ai​ 且 b_j \leq b_ibj​≤bi 阅读全文
posted @ 2019-11-30 16:52 cherish__lin 阅读(184) 评论(0) 推荐(0)
摘要:Cao Cao made up a big army and was going to invade the whole South China. Yu Zhou was worried about it. He thought the only way to beat Cao Cao is to 阅读全文
posted @ 2019-08-08 20:46 cherish__lin 阅读(218) 评论(0) 推荐(0)
摘要:Rar the Cat((™)) is the founder of ACM (Association of Cats and Magical Lights). This is the story of the founding of ACM. It is the second half of th 阅读全文
posted @ 2019-06-11 23:28 cherish__lin 阅读(332) 评论(0) 推荐(0)
摘要:题目描述 逝者如斯夫,不舍昼夜! 叶良辰认为,他的寿命是无限长的,而且每天都会进步。 叶良辰的生命的第一天,他有1点能力值。第二天,有2点。第n天,就有n点。也就是S[i]=i 但是调皮的小A使用时光机,告诉他第x天和第y天,就可以任意交换某两天的能力值。即S[x]<-->S[y] 小A玩啊玩,终于 阅读全文
posted @ 2019-06-02 21:17 cherish__lin 阅读(159) 评论(0) 推荐(0)
摘要:For the k-th number, we all should be very familiar with it. Of course,to kiki it is also simple. Now Kiki meets a very similar problem, kiki wants to 阅读全文
posted @ 2019-06-01 21:43 cherish__lin 阅读(364) 评论(0) 推荐(0)
摘要:There is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefu 阅读全文
posted @ 2019-06-01 20:39 cherish__lin 阅读(296) 评论(0) 推荐(0)
摘要:Long long ago, there is a sequence A with length n. All numbers in this sequence is no smaller than 1 and no bigger than n, and all numbers are differ 阅读全文
posted @ 2019-05-31 23:26 cherish__lin 阅读(139) 评论(0) 推荐(0)