
单调栈
Timeclimber
这个作者很懒,什么都没留下…
展开
-
poj3250 Bad Hair Day (单调栈)
单调栈裸题#include #include #include #include using namespace std; int main() { int n; while(~scanf("%d",&n)) { stack sta; int t; long long sum=0; scanf("%d原创 2017-07-28 20:23:57 · 780 阅读 · 1 评论 -
poj 2559
题意是求连续的最大矩形的面积 可以假设每一点的高度都是最小的,然后分别向左向右找到最后一个满足使它高度仍然是最小的位置,分别记录下来 每次搜寻都可以利用前面已搜索的结果减少重复搜索 #include #include #include #define MAX_N 100005 using namespace std; int main() { int n; while原创 2017-07-29 10:46:23 · 805 阅读 · 0 评论 -
poj 2796 Feel Good
题意是给出一串数,求给定的范围内最小值乘该范围内所有值的和的最大值 方法和poj 2559相同,仍然是假设某一点的数值是最小的,求左右两端可到达的最远的位置 #include #include #include #include #define MAX_N 100000 using namespace std; int n,a[MAX_N+5],l[MAX_N+5],r[MAX_N+5原创 2017-07-29 14:22:24 · 382 阅读 · 0 评论 -
poj 3494 Largest Submatrix of All 1’s
Description Given am-by-n(0,1)-matrix, of all its submatrices of all 1’s which is the largest? Bylargestwe mean that the submatrix has the most elements. Input The input contains multiple test ...原创 2017-07-29 15:33:06 · 413 阅读 · 0 评论 -
hdu 5033 Building(单调栈)
Building Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 2807 Accepted Submission(s): 784 Special Judge Problem Description Once u原创 2017-07-29 21:10:16 · 406 阅读 · 0 评论 -
codeforces 631C (单调栈+思维)
C. Report time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Each month Blake gets the report containing main原创 2017-11-22 20:14:14 · 543 阅读 · 0 评论 -
2019牛客暑期多校训练营(第一场)A Equivalent Prefixes
题意: 定义了RMQ(u,L,R) 代表的是u数组中[L,R]中最小值的下标。现在给了A和B两个数组。 要找到最长的m,使得任意的l,r满足1<=L<=R<=m,能够使得RMQ(A,L,R)==RMQ(B,L,R)。 思路: 可以这么考虑,当已经确定了1<=L<=R<=p,都能使得RMQ的条件成立。然后讨论p+1是否可以纳入答案。 如果p+1,并不能被统计到答案...原创 2019-07-19 15:20:27 · 182 阅读 · 0 评论