SakuraSa
第二题的数据规模是多少呢

[mw_shl_code=python,true]class FireMap:

def __init__(self,inputMap,size):

self.size=size;self.m=list()

for line in inputMap:

lst=list()

for ch in line:

lst.append(0 if ch=='.' else False)

self.m.append(lst)

def putFire(self,x,y):

if self.m[x][y] is False or self.m[x][y]>0:return False

self.putoutFire(x,y,1)

return True

def putoutFire(self,x,y,ch=-1):

self.__fire__(x,y,1,0,ch,True);self.__fire__(x,y,-1,0,ch)

self.__fire__(x,y,0,1,ch);self.__fire__(x,y,0,-1,ch)

def maxFire(self,counter=0):

maxCount=counter

for x in xrange(self.size):

for y in xrange(self.size):

if self.putFire(x,y):

maxCount=max(self.maxFire(counter+1),counter)

self.putoutFire(x,y)

return maxCount

def __fire__(self,px,py,dx,dy,ch,firstPos=False):

if not firstPos:

px+=dx;py+=dy

while px>=0 and py>=0 and px<self.size and py<self.size and (not self.m[px][py] is False):

self.m[px][py]+=ch

px+=dx;py+=dy

def getMap(size):

m=list()

for i in xrange(size): m.append(raw_input().strip())

return m

if __name__=='__main__':

while 1:

n=int(raw_input())

if n==0: break

print FireMap(getMap(n),n).maxFire()[/mw_shl_code]第二题的数据规模是多少呢0w0?

我这渣渣算法绝对只能过小数据……