08 2018 档案
摘要:算法思想:失之东隅,收之桑隅 对于一个序列,它正向最长上升子序列的长度就是它反向最长下降子序列的个数。 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<math.h> 5 #include<algori
阅读全文
摘要:杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。 不吉利的数字为所有含有4或62的号码。例如: 62315 73418 8891
阅读全文
摘要:我感觉划分树的基本思想是二分和归并排序,分为建树和查询两个部分。 1、建树 递归建树,以中值为界,将序列划分成左右两部分,直到分到每个点为止。同时,在建树的过程中,记录下每一层进入左区间的数的个数,方便查询时使用。 注意:保持左右区间中数的相对顺序。 (1)、中值唯一的情况。将小于等于中值的数放到左
阅读全文
摘要:People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numb
阅读全文
摘要:线段树几个基本操作 单点查询 单点修改 区间查询 区间修改 区间求最大值 主要思想: 将一个线性的一维数组构建成树形的数组,使得可以用二分的思想来进行区间操作,降低时间复杂度,但是多占用了空间,典型的用空间换时间。 一个特殊的模块: lazy数组,考虑到对区间的操作有很多次,并且没有必要每一次对区间
阅读全文
摘要:A rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In the figure, each node is labeled with
阅读全文
摘要:Description Natasha is planning an expedition to Mars for nn people. One of the important tasks is to provide food for each participant. The warehouse
阅读全文
摘要:Description A bracket sequence is a string containing only characters "(" and ")". A regular bracket sequence is a bracket sequence that can be transf
阅读全文
摘要:You have a Petri dish with bacteria and you are preparing to dive into the harsh micro-world. But, unfortunately, you don't have any microscope nearby
阅读全文
摘要:There are nn houses in a row. They are numbered from 11 to nn in order from left to right. Initially you are in the house 11. You have to perform kk m
阅读全文
摘要:Slava plays his favorite game "Peace Lightning". Now he is flying a bomber on a very specific map. Formally, map is a checkered field of size 1 × n, t
阅读全文
摘要:Even if the world is full of counterfeits, I still regard it as wonderful. Pile up herbs and incense, and arise again from the flames and ashes of its
阅读全文
摘要:看了很长时间大佬的博客,终于明白了区间修改和单点查询的原理,因为大佬们的思维比较强大,所以菜鸡决定写一篇较为详细的解释。 首先引入差分数组d,设原数组为a,令d[i]=a[i]-a[i-1].由此关系式得,也就是a[j]等于d[j]的前 j 项和,即前缀和。 于此,我们的树状数组维护的是 d 的前缀
阅读全文

浙公网安备 33010602011771号