Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

本题算法

Posted by x5471140 at 2010-02-14 21:51:40 on Problem 3363
提供一个很简单的办法,时间复杂度o(m*n)。
首先看最左上角的像素(坐标 0,0 ),如果是1,则肯定要以此像素为左上角顶点画矩形(因为只有这个矩形可以改变这个像素),如果是0则不画.然后看(0,1)像素,如果是1,则要以(0,1)为左上顶点画矩形,是0则不画...... 对于任意(0,i)像素,若这点值是1就画,否则就不画...
以此类推,对于任意(i,j)像素,是否以该点为顶点画矩形都取决于这点的像素值.这样扫描完整个矩形区域,就可以得到答案

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator