Beispiel #1
0
 def test0(self):
     so = lc_329.Solution()
     nums = [
         [9, 9, 4],
         [6, 6, 8],
         [2, 1, 1]
     ]
     ans = so.longestIncreasingPath(nums)
     self.assertEquals(4, ans)
Beispiel #2
0
 def test_wa(self):
     nums = [
         [11,2,11,0,15,12,4,15,0,14,11,3,19,11,5,11,18,19,4,3,11,1,9,17,5,2,15,18,11,15],
     [12,10,8,15,4,7,4,5,7,8,5,12,3,3,10,12,16,15,17,13,13,16,0,0,17,17,11,3,14,0],
     [8,18,1,6,15,16,14,11,9,11,3,4,17,7,2,16,18,2,0,0,16,18,10,15,14,18,10,19,17,6],
     [14,17,4,13,13,6,16,1,3,18,18,18,4,1,15,4,0,9,19,3,6,7,19,13,11,11,10,19,3,15],
     [16,6,19,17,19,17,5,12,6,3,1,0,3,10,13,18,4,3,9,0,1,18,9,15,18,3,4,6,1,15],
     [1,2,12,9,9,7,17,0,1,14,18,1,5,3,0,7,2,19,7,19,1,11,1,3,2,4,0,3,16,18],
     [18,10,10,3,12,11,7,8,3,16,7,11,11,12,15,1,13,9,8,17,1,9,7,19,1,14,8,10,18,14],
     [5,19,9,4,10,14,1,5,11,16,11,3,5,4,19,8,11,16,19,12,6,3,18,16,17,8,11,19,7,14],
     [0,15,17,11,10,13,19,0,10,3,15,19,3,3,3,4,3,12,17,10,5,16,12,5,5,17,5,17,6,6],
     [8,19,9,3,13,8,13,17,4,12,13,8,13,12,10,10,16,7,2,8,17,3,7,1,7,16,11,19,13,19],
     [6,19,6,13,10,5,14,7,3,1,10,6,4,8,15,0,0,2,12,13,14,14,7,5,1,16,15,15,4,7],
     [7,7,11,14,2,4,14,2,2,0,6,11,15,14,11,13,2,3,14,9,16,3,8,15,2,18,15,15,2,2],
     [7,5,12,10,14,3,6,9,2,1,2,15,0,4,7,9,7,12,15,9,2,13,7,8,7,9,4,3,5,19],
     [11,9,1,8,0,15,1,6,5,11,14,19,6,11,0,12,1,6,8,7,0,1,2,9,14,4,5,8,3,16],
     [8,0,11,5,14,4,19,0,6,8,1,10,13,8,18,6,6,4,5,9,10,14,14,13,12,16,4,3,3,11],
     [0,9,6,19,16,4,5,10,13,19,8,15,14,7,13,11,17,18,14,18,19,11,0,4,12,11,2,8,17,14],
     [16,19,16,9,9,14,5,13,7,10,18,6,15,12,12,1,11,16,1,8,1,7,16,7,19,6,12,0,15,0],
     [2,4,18,15,13,9,4,18,19,5,16,7,10,1,7,7,4,4,10,8,13,15,9,4,16,13,6,3,13,7],
     [3,11,10,13,6,4,0,13,11,4,5,6,19,13,8,10,8,9,2,4,4,11,12,8,12,15,6,1,10,12],
     [7,6,19,3,2,14,15,6,9,1,6,14,4,15,13,9,14,7,10,12,17,18,6,4,12,4,1,6,6,12],
     [15,17,9,15,9,15,9,10,10,11,12,17,2,18,11,0,6,11,14,17,2,13,9,13,3,4,3,1,8,11],
     [17,13,12,17,4,19,19,7,7,13,19,10,4,16,1,18,14,2,9,18,2,8,3,1,10,9,12,6,2,11],
     [17,12,6,8,3,16,5,2,16,3,13,3,13,9,11,11,5,12,14,16,3,19,16,16,1,14,5,3,17,19],
     [1,4,0,3,1,17,5,15,2,19,12,7,18,13,1,0,7,2,9,18,10,18,8,9,13,13,8,10,14,14],
     [9,14,4,18,10,18,3,9,9,17,16,4,19,7,3,18,7,0,10,13,9,10,11,16,3,5,1,2,16,19],
     [8,10,13,8,7,2,9,4,16,15,5,4,15,7,9,7,15,2,6,17,14,3,13,3,4,15,13,10,8,16],
     [17,7,19,19,13,12,6,0,11,4,10,4,1,9,15,9,7,7,14,6,7,18,9,13,6,16,5,2,17,1],
     [2,7,0,4,8,18,4,11,13,4,11,12,3,18,11,2,4,18,3,3,17,9,18,11,9,15,14,19,7,17],
     [13,1,15,18,4,12,18,18,15,16,7,17,9,15,11,3,9,7,18,13,3,11,7,19,10,10,7,13,7,19],
     [17,17,14,3,19,7,1,13,9,3,6,16,10,8,14,8,17,18,12,11,4,11,10,15,9,0,4,12,7,15],
     [4,4,8,1,7,11,13,4,11,5,18,2,16,11,16,13,0,13,13,12,11,15,8,4,0,3,2,9,8,15],
     [17,4,13,5,3,17,14,4,7,6,6,11,16,18,2,0,3,12,1,5,12,16,3,14,4,16,5,8,15,9],
     [5,3,17,17,6,4,19,5,4,6,11,4,14,18,4,19,16,15,1,17,3,8,13,14,16,13,18,19,6,4],
     [15,0,8,15,6,6,11,8,18,2,4,10,18,16,15,8,1,5,9,13,7,19,12,2,9,18,1,15,12,8],
     [5,0,18,14,1,8,18,15,5,13,15,7,8,8,9,0,14,12,4,17,2,10,9,7,19,7,19,9,7,1],
     [7,4,16,16,13,4,3,6,15,11,14,7,3,0,5,15,10,13,18,18,11,6,7,9,19,13,4,2,7,9],
     [9,14,15,11,14,5,15,1,19,15,3,4,0,10,4,1,2,15,18,15,15,2,9,0,3,10,9,16,4,1],
     [14,13,17,19,0,13,15,9,16,18,5,6,16,16,6,10,14,15,17,5,9,2,5,11,19,19,11,6,15,14],
     [17,7,19,6,5,19,10,2,11,17,17,13,16,13,19,4,12,3,4,13,7,9,19,9,12,3,16,8,18,13]
     ]
     so = lc_329.Solution()
     ans = so.longestIncreasingPath(nums)
     self.assertEquals(9, ans)
Beispiel #3
0
 def test_timeout1(self):
     nums = [[0,1,2,3,4,5,6,7,8,9],
             [19,18,17,16,15,14,13,12,11,10],
             [20,21,22,23,24,25,26,27,28,29],
             [39,38,37,36,35,34,33,32,31,30],
             [40,41,42,43,44,45,46,47,48,49],
             [59,58,57,56,55,54,53,52,51,50],
             [60,61,62,63,64,65,66,67,68,69],
             [79,78,77,76,75,74,73,72,71,70],
             [80,81,82,83,84,85,86,87,88,89],
             [99,98,97,96,95,94,93,92,91,90],
             [100,101,102,103,104,105,106,107,108,109],
             [119,118,117,116,115,114,113,112,111,110],
             [120,121,122,123,124,125,126,127,128,129],
             [139,138,137,136,135,134,133,132,131,130],
             [0,0,0,0,0,0,0,0,0,0]]
     so = lc_329.Solution()
     ans = so.longestIncreasingPath(nums)
     self.assertEquals(140, ans)
Beispiel #4
0
 def test_timeout(self):
     nums = [[10,7,7,9,17,0,8,8,18,9,4,6,13,18,11,3,18,1,10,5,16,12,9],[16,14,9,8,19,14,9,7,15,9,18,12,2,11,10,18,16,3,0,16,14,10,14],[6,13,5,2,12,7,6,2,2,10,2,7,0,12,13,14,8,18,17,2,9,14,12],[2,19,8,10,14,9,6,8,1,2,7,4,10,0,2,1,13,19,0,14,6,3,3],[6,15,14,19,19,11,17,16,18,15,13,2,11,18,2,9,11,18,8,16,18,9,10],[8,6,15,8,3,14,0,0,4,7,18,13,11,7,5,9,0,19,15,6,16,15,13],[16,8,2,11,9,18,8,8,2,4,13,12,1,16,18,11,12,18,3,9,2,0,3],[17,13,19,1,12,5,16,18,9,19,6,15,14,6,4,9,6,19,12,10,10,19,1],[19,11,11,6,5,5,7,15,6,18,13,9,6,15,18,4,14,4,10,8,16,8,17],[18,1,7,9,0,16,3,8,12,1,14,8,15,6,6,6,1,9,0,4,1,7,0],[5,2,5,13,7,10,10,13,16,16,5,7,14,1,1,8,6,3,18,18,12,6,3],[8,18,16,6,4,2,16,8,6,10,4,15,9,15,3,14,8,2,10,8,15,4,14],[12,1,16,0,9,10,15,10,2,6,3,2,1,13,5,17,5,10,2,8,11,7,17],[15,6,7,3,4,15,2,11,16,8,6,2,18,11,15,16,0,16,10,1,1,9,11],[15,17,10,17,19,12,1,11,19,3,15,4,16,18,1,0,5,19,18,14,0,0,14],[7,4,19,13,2,13,11,2,18,12,19,19,12,11,3,10,5,5,15,13,8,3,0]]
     so = lc_329.Solution()
     ans = so.longestIncreasingPath(nums)
     self.assertEquals(11, ans)