結果

問題 No.2639 Longest Increasing Walk
ユーザー ゼットゼット
提出日時 2024-02-19 21:57:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 453 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 123,764 KB
最終ジャッジ日時 2024-02-19 21:57:26
合計ジャッジ時間 7,501 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
53,460 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 41 ms
53,460 KB
testcase_03 AC 31 ms
53,460 KB
testcase_04 AC 186 ms
118,644 KB
testcase_05 AC 217 ms
121,460 KB
testcase_06 AC 214 ms
123,252 KB
testcase_07 AC 354 ms
122,996 KB
testcase_08 AC 248 ms
123,508 KB
testcase_09 AC 360 ms
123,764 KB
testcase_10 AC 441 ms
100,516 KB
testcase_11 AC 433 ms
95,984 KB
testcase_12 AC 97 ms
78,908 KB
testcase_13 AC 453 ms
106,996 KB
testcase_14 AC 275 ms
92,672 KB
testcase_15 AC 34 ms
53,460 KB
testcase_16 AC 57 ms
68,788 KB
testcase_17 AC 214 ms
92,788 KB
testcase_18 AC 318 ms
96,512 KB
testcase_19 AC 119 ms
80,504 KB
testcase_20 AC 213 ms
87,296 KB
testcase_21 AC 424 ms
96,704 KB
testcase_22 AC 177 ms
82,192 KB
testcase_23 AC 45 ms
64,208 KB
testcase_24 AC 42 ms
62,116 KB
testcase_25 AC 53 ms
66,716 KB
testcase_26 AC 33 ms
53,460 KB
testcase_27 AC 53 ms
68,784 KB
testcase_28 AC 33 ms
53,460 KB
testcase_29 AC 32 ms
53,460 KB
testcase_30 AC 31 ms
53,460 KB
testcase_31 AC 32 ms
53,460 KB
testcase_32 AC 32 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W=map(int,input().split())
A=[list(map(int,input().split())) for i in range(H)]
L=[]
for i in range(H):
  for j in range(W):
    L.append((A[i][j],i,j))
L.sort()
dp=[[1]*W for i in range(H)]
DX=[1,0,-1,0]
DY=[0,1,0,-1]
for i in range(len(L)):
  x,y=L[i][1],L[i][2]
  for dx,dy in zip(DX,DY):
    x2,y2=x+dx,y+dy
    if x2<0 or x2>=H or y2<0 or y2>=W:
      continue
    if A[x][y]<=A[x2][y2]:
      continue
    dp[x][y]=max(dp[x][y],dp[x2][y2]+1)
result=0
for i in range(H):
  result=max(result,max(dp[i]))
print(result)
0