hdu2870 Largest Submatrix 单调栈】的更多相关文章

描述 就不需要描述了... 题目传送门 题解 被lyd的书的标签给骗了(居然写了单调队列优化dp??)  看了半天没看出来哪里是单调队列dp,表示强烈谴责QAQ w x y z  可以各自 变成a ,b c 中的几种, 那么只需要考虑矩阵由 a, b 或 c 构成就可以了. 对于每一种情况都枚举一次, 比如现在考虑由 a 构成的矩阵, 只需要将能 w y z a 的位置记为 1, 其他位置记为 0 ,然后找面积最大的 由 1 组成的矩阵即可. 那么这题就是道 单调栈裸题了  (   不会的同学可…
http://acm.hdu.edu.cn/showproblem.php? pid=2870 Largest Submatrix Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1569    Accepted Submission(s): 748 Problem Description Now here is a matrix wi…
Largest Submatrix Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3105    Accepted Submission(s): 1476 Problem Description Now here is a matrix with letter 'a','b','c','w','x','y','z' and you ca…
Largest Rectangle in a Histogram Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 26549   Accepted: 8581 Description A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal wi…
Largest Submatrix of All 1’s Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 8551   Accepted: 3089 Case Time Limit: 2000MS Description Given a m-by-n (0,1)-matrix, of all its submatrices of all 1’s which is the largest? By largest we me…
Given a m-by-n (0,1)-matrix, of all its submatrices of all 1's which is the largest? By largest we mean that the submatrix has the most elements. Input The input contains multiple test cases. Each test case begins with m and n (1 ≤ m, n ≤ 2000) on li…
POJ 3494 Largest Submatrix of All 1’s Description Given a m-by-n (0,1)-matrix, of all its submatrices of all 1’s which is the largest? By largest we mean that the submatrix has the most elements. Input The input contains multiple test cases. Each tes…
Largest Rectangle in a Histogram http://poj.org/problem?id=2559 题意:给出若干宽度相同的矩形的高度(条形统计图),求最大子矩形面积 解题思路 单调栈的经典题(嫌弃字多可以先看后面的示例再来看这个思路) 显然,最终的子矩形高度一定和某一个矩形相等(反证).因此一个暴力的做法就是枚举每一个矩形,然后往两边扩散.在它左侧找到第一个高度比它小的,右侧也一样.则可以求出最大可扩散宽度,乘上高度即可以更新答案.复杂度O(n2) 如果说要优化刚才…
Largest Submatrix of All 1’s Given a m-by-n (0,1)-matrix, of all its submatrices of all 1’s which is the largest? By largest we mean that the submatrix has the most elements. Input The input contains multiple test cases. Each test case begins with m …
http://www.spoj.com/problems/MINSUB/en/ 题意:给出一个n*m的矩阵M,和一个面积k,要使得M的子矩阵M'的最小元素最大并且面积大于等于k,问子矩阵M'的最小元素最大能是多少,并且求出最大的面积. 思路:二分一个最小元素x,转化为判断矩阵M里面是否存在一个子矩阵使得这个子矩阵的面积大于等于k并且所有元素都大于x. 用另一个矩阵,1表示该位置的元素大于等于x,0表示元素小于x. 转化为判断是否存在一个子矩阵元素为1的面积大于等于k. 这样可以用到早上学习的单调…