码迷,mamicode.com
首页 >  
搜索关键字:单调栈    ( 756个结果
POJ3250---Bad Hair Day(单调栈)
DescriptionSome of Farmer John’s N cows (1 ≤ N ≤ 80,000) are having a bad hair day! Since each cow is self-conscious about her messy hairstyle, FJ wants to count the number of other cows that can see t...
分类:其他好文   时间:2015-05-07 22:16:34    阅读次数:168
hdu1506---Largest Rectangle in a Histogram(单调栈)
Problem Description A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figur...
分类:其他好文   时间:2015-05-07 22:16:16    阅读次数:143
POJ2796---Feel Good(前缀和+单调栈维护)
Description Bill is developing a new mathematical theory for human emotions. His recent investigations are dedicated to studying how good or bad days influent people’s memories about some period of li...
分类:其他好文   时间:2015-05-07 22:12:48    阅读次数:198
POJ2082---Terrible Sets(单调栈)
Description Let N be the set of all natural numbers {0 , 1 , 2 , … }, and R be the set of all real numbers. wi, hi for i = 1 … n are some elements in N, and w0 = 0. Define set B = { | x, y ∈...
分类:其他好文   时间:2015-05-07 22:09:58    阅读次数:139
福州大学第十二届程序设计竞赛题解
A:这题利用单调栈,先预处理出每个位置向下的最远位置,那么每一行单独考虑,每行就相当于一些段的子矩阵个数,利用单调栈维护,每次出栈的时候把大于当前要入栈(高度0的不入栈了)的段的部分计算出来,累加一下答案即可 B:这题可以枚举,因为一个10^15开3方之后是10^5枚举起来是没有问题的,然后枚举一个数字i,等于要计算在max(a, i * i * i)到min(i * i * i, b)区间,有...
分类:其他好文   时间:2015-05-04 06:28:46    阅读次数:155
BZOJ3238 [Ahoi2013]差异
首先把后缀数组和height数组都搞出来。。。然后用两个单调栈维护$[l, r]$表示对于一个点$x$,满足$height[x] \le height[l..x] \ \&\&\ height[x] 11 #include 12 13 using namespace std;14 typedef ....
分类:其他好文   时间:2015-05-03 23:27:36    阅读次数:148
UVa 12265 (单调栈) Selling Land
紫书上分析了很多很多,超详细,= ̄ω ̄=每扫描一行可以计算一个height数组,表示从这块空地向上延伸多少块空地,而且这个数组可以逐行递推。首先对于每一行来说维护一个单调栈,栈里放的是矩形的左上角,而且横坐标c和高度h也都是递增的,另外对于扫描到的同一个右下角,矩形面积的大小只与左上角的横坐标c和高...
分类:其他好文   时间:2015-04-29 16:27:04    阅读次数:140
(单调栈+二分) bzoj 1012
1012: [JSOI2008]最大数maxnumberTime Limit:3 SecMemory Limit:162 MBSubmit:4909Solved:2221[Submit][Status][Discuss]Description现在请求你维护一个数列,要求提供以下两种操作: 1、 查询...
分类:其他好文   时间:2015-04-22 20:38:02    阅读次数:144
【BZOJ 3190】 [JLOI2013]赛车
转化+计算几何+单调栈~...
分类:其他好文   时间:2015-04-19 10:11:41    阅读次数:168
POJ 3415 Common Substrings
单调栈的思想很巧妙,若进入的元素比栈顶小,则栈顶出栈,把相应信息更新一下,直到要进入的元素比栈顶元素大 //注意这道题和Facer’s string这道题的区别 //该题求的是sa[i]-sa[j]的lcp,需要用到的是height[i+1]-height[j] //而 Facer’s string这道题用到的是height[i]-height[j]的值,涉及到的是sa[i-1]-sa[j] ...
分类:其他好文   时间:2015-04-16 19:57:25    阅读次数:136
756条   上一页 1 ... 67 68 69 70 71 ... 76 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!