<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> class Solution ( object ) : <EOL> def __init__ ( self ) : <EOL> self . max = - <NUM_LIT:1> <EOL> self . cur_area = <NUM_LIT:0> <EOL> self . dirs = [ ( <NUM_LIT:0> , <NUM_LIT:1> ) , ( <NUM_LIT:0> , - <NUM_LIT:1> ) , ( <NUM_LIT:1> , <NUM_LIT:0> ) , ( - <NUM_LIT:1> , <NUM_LIT:0> ) , ( <NUM_LIT:1> , <NUM_LIT:1> ) , ( <NUM_LIT:1> , - <NUM_LIT:1> ) , ( - <NUM_LIT:1> , <NUM_LIT:1> ) , ( - <NUM_LIT:1> , - <NUM_LIT:1> ) ] <EOL> def solve ( self , cipher ) : <EOL> """<STR_LIT>""" <EOL> m , n , mat = cipher <EOL> visited = [ [ False for _ in xrange ( n ) ] for _ in xrange ( m ) ] <EOL> for i in xrange ( m ) : <EOL> for j in xrange ( n ) : <EOL> if not visited [ i ] [ j ] and mat [ i ] [ j ] == <NUM_LIT:1> : <EOL> self . cur_area = <NUM_LIT:0> <EOL> self . dfs ( visited , mat , i , j , m , n ) <EOL> return self . max <EOL> def dfs ( self , visited , mat , i , j , m , n ) : <EOL> visited [ i ] [ j ] = True <EOL> self . cur_area += <NUM_LIT:1> <EOL> self . max = max ( self . max , self . cur_area ) <EOL> for dir in self . dirs : <EOL> i1 = i + dir [ <NUM_LIT:0> ] <EOL> j1 = j + dir [ <NUM_LIT:1> ] <EOL> if <NUM_LIT:0> <= i1 < m and <NUM_LIT:0> <= j1 < n and not visited [ i1 ] [ j1 ] and mat [ i1 ] [ j1 ] == <NUM_LIT:1> : <EOL> self . dfs ( visited , mat , i1 , j1 , m , n ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> import sys <EOL> f = open ( "<STR_LIT>" , "<STR_LIT:r>" ) <EOL> solution = Solution ( ) <EOL> m = int ( f . readline ( ) . strip ( ) ) <EOL> n = int ( f . readline ( ) . strip ( ) ) <EOL> mat = [ ] <EOL> for i in xrange ( m ) : <EOL> mat . append ( map ( int , f . readline ( ) . strip ( ) . split ( '<STR_LIT:U+0020>' ) ) ) <EOL> cipher = m , n , mat <EOL> s = "<STR_LIT>" % ( solution . solve ( cipher ) ) <EOL> print s , </s>
