题意 求最大相同字符子矩阵 其中一些字符可以转换
其实就是HDU1505 1506的加强版 但是分了a,b,c三种情况 看哪次得到的面积最大
对于某一个情况 可以把该字符和可以转换为该字符的位置赋值0 其它位置赋值1 这样就转化成了求最大全0矩阵的问题了
对于转换后矩阵中的每个点 看他向上有多少个连续0 把这个值存在h数组中 再用l数组和r数组记录h连续大于等于该位置的最左边位置和最右位置 这样包含(i,j)点的最大矩阵面积就是(r[i][j]-l[i][j]+1)*h[i][j] 面积最大的点就...
分类:
其他好文 时间:
2014-08-11 15:04:42
阅读次数:
195
Description
0 s, 1 s and ? Marks
Given a string consisting of 0, 1 and ? only, change all the
? to 0/1, so that the size of the largest group is minimized. A group is a subs...
分类:
其他好文 时间:
2014-08-11 11:57:42
阅读次数:
197
Understanding the node.js event loopThe first basic thesis of node.js is that I/O is expensive:So the largest waste with current programming technolog...
分类:
其他好文 时间:
2014-08-10 21:21:30
阅读次数:
469
Maximum SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[?...
分类:
其他好文 时间:
2014-08-10 21:18:20
阅读次数:
232
Largest Rectangle in a HistogramTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11219Accepted Subm...
分类:
其他好文 时间:
2014-08-10 18:24:20
阅读次数:
225
思路1.
当前为n的面积如何与n-1相联系,dp[i][j]=max(dp[i-1][k]) , 0<k<=j
描述:i为方块个数,j为高度
但是此题目的数据对于高度太变态,h,1000000000 ,n,100000
所以不可行(一般计算机为Ghz 相当于1S十几亿运算)
思路2.
此题目寻找的最大面积,对于一个方块来说则是以自己为中心左右两端比自己高
的方块累计和与自己面积的乘积,取最大值。状态转移则可看作已知前面n-1个左边比自己
高的的位置l[i],则如果该下标对应的数据比自己还高,继续往下找。利...
分类:
其他好文 时间:
2014-08-10 13:09:30
阅读次数:
278
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the contiguous subarray [4,?1,2,1] ha...
分类:
其他好文 时间:
2014-08-05 22:37:50
阅读次数:
188
Problem B: The Largest Clique
Given a directed graph G, consider the following transformation. First, create a new graph T(G) to have the same vertex set as G. Create a directed edge between two ve...
分类:
其他好文 时间:
2014-08-05 19:26:40
阅读次数:
365
Data Structures
1. Integer
– find number of 1s
– next largest smaller
– smallest larger number
– determine if is palindrom
– itoa, atoi
– add 2 numbers w/...
分类:
其他好文 时间:
2014-08-05 15:50:40
阅读次数:
408
uva 11324 The Largest Clique(图论-tarjan,动态规划)
题目大意:
T组测试数据,给一张有向图G,求一个结点数最大的结点集,使得该结点中任意两个结点 u 和 v满足:要么 u 可以到达 v, 要么 v 可以到达 u(u 和 v 相互可达也可以)。
解题思路:
”同一个强连通分量中的点要么都选,要么不选。把强连通分量收缩点后得到SCC图,让每个SCC结点的权等于它的结点数,则题目转化为求SCC图上权最大的路径。由于SCC图是一个 DAG, 可以用动态规划求解。“...
分类:
其他好文 时间:
2014-08-05 14:17:19
阅读次数:
244