2013年6月15日

MUTC 3 D - Cut the cake 最大子矩阵

摘要: Cut the cakeTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 835Accepted Submission(s): 308Problem DescriptionMark bought a huge cake, because his friend ray_sun’s birthday is coming. Mark is worried about how to divide the cake since it’s so huge a 阅读全文

posted @ 2013-06-15 11:51 电子幼体 阅读(164) 评论(0) 推荐(0) 编辑

UVa 1330 - City Game 最大子矩阵

摘要: Bob is a strategy game programming specialist. In his new city building game the gaming environment is as follows: a city is built up by areas, in which there are streets, trees, factories and buildings. There is still some space in the area that is unoccupied. The strategic task of his game is to w 阅读全文

posted @ 2013-06-15 10:59 电子幼体 阅读(142) 评论(0) 推荐(0) 编辑

扫描线法求最大子矩阵

摘要: 问题描述:给定一个N*M的矩阵,其中有一些格子是空地,其他是障碍。找出一个全部由空地组成的面积/周长最大的子矩阵。朴素算法:枚举左上角的坐标O(mn)和右下角的坐标O(mn),判断是否全为空地O(mn),时间复杂度为O(m3*n3)。扫描线法:把点(i,j)向上所有连续的空格看做一条悬线。矩阵中的每个点都向上对应了一条悬线。①用h[i,j]表示点(i,j)对应的悬线长度。当(i,j)为障碍时,h[i,j]=0;当(i,j)为空格时,h[i,j]=h[i-1,j]+1。②用left[i,j]表示点(i,j)对应的悬线的左边界。当(i,j)为障碍时,left[i,j]=左边界;当(i,j)为空格时 阅读全文

posted @ 2013-06-15 09:58 电子幼体 阅读(239) 评论(0) 推荐(0) 编辑

导航