码迷,mamicode.com
首页 >  
搜索关键字:树状    ( 5251个结果
BZOJ 3173 [Tjoi2013] 最长上升子序列 解题报告
这个题感觉比较简单,但却比较容易想残。。我不会用树状数组求这个原排列,于是我只好用线段树。。。毕竟 Gromah 果弱马。我们可以直接依次求出原排列的元素,每次找到最小并且最靠右的那个元素,假设这是第 $i$ 次找的,那么这就是原排列的第 $i$ 项,然后我们就把这个元素删去(变成很大的数),再把这...
分类:其他好文   时间:2015-06-25 22:53:09    阅读次数:127
POJ3321:Apple Tree(树状数组)
Description 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 carefully nurturing the big apple tree. ...
分类:移动开发   时间:2015-06-25 12:24:40    阅读次数:161
BZOJ3658 : Jabberwocky
考虑将某线段下方的点取走:将所有点从低到高排序每扫描到一条水平线,对于上面每个点,找到它下面同色的前驱后继,统计中间点的个数然后再把线上所有点插入数据结构中最后再统计相邻的同色的点之间的点个数用动态开点的权值线段树+树状数组维护,时间复杂度$O(n\log n)$。考虑将某线段上方的点取走:把扫描线...
分类:其他好文   时间:2015-06-24 14:23:26    阅读次数:82
POJ2155:Matrix(二维树状数组,经典)
Description Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 We can change the matrix in the f...
分类:编程语言   时间:2015-06-24 12:54:29    阅读次数:132
SGU180:Inversions(树状数组)
There are N integers (1A[j]. Input The first line of the input contains the number N. The second line contains N numbers A1...AN. Output Write amount of such pairs. Sample test(s)...
分类:编程语言   时间:2015-06-24 11:01:38    阅读次数:122
POJ3067:Japan(树状数组求逆序对)
Description Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <...
分类:编程语言   时间:2015-06-23 23:18:22    阅读次数:206
POJ2029:Get Many Persimmon Trees(二维树状数组)
Description Seiji Hayashi had been a professor of the Nisshinkan Samurai School in the domain of Aizu for a long time in the 18th century. In order to reward him for his meritorious career in educa...
分类:编程语言   时间:2015-06-23 23:13:06    阅读次数:257
POJ2481:Cows(树状数组)
Description Farmer John's cows have discovered that the clover growing along the ridge of the hill (which we can think of as a one-dimensional number line) in his field is particularly good.  ...
分类:编程语言   时间:2015-06-23 21:41:15    阅读次数:155
SPOJ 1029 Matrix Summation【 二维树状数组 】
题意:二维树状数组,更改值的时候有一点不一样,是将a[x][y]设置为一个值,所以add的时候要将它和以前的值作差一下 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #in...
分类:编程语言   时间:2015-06-23 15:06:57    阅读次数:156
HOJ 1867 经理的烦恼 【 树状数组 】
题意:给出一个区间,求这个区间里面素数的个数这道题wa了好多次---是因为add操作没有写对每次更新的时候,应该先判断没有加上y是不是质数,加上了y是不是质数如果从质数变成不是质数,那么add(x,-1)如果从不是质数变成是质数,那么add(x,1)另外还pe了,,printf("\n")就不对,p...
分类:编程语言   时间:2015-06-23 09:53:40    阅读次数:127
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!