結果
問題 | No.2639 Longest Increasing Walk |
ユーザー |
![]() |
提出日時 | 2024-02-19 21:57:17 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 502 ms / 2,000 ms |
コード長 | 524 bytes |
コンパイル時間 | 202 ms |
コンパイル使用メモリ | 82,380 KB |
実行使用メモリ | 124,088 KB |
最終ジャッジ日時 | 2024-09-29 01:56:28 |
合計ジャッジ時間 | 7,128 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
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+dyif x2<0 or x2>=H or y2<0 or y2>=W:continueif A[x][y]<=A[x2][y2]:continuedp[x][y]=max(dp[x][y],dp[x2][y2]+1)result=0for i in range(H):result=max(result,max(dp[i]))print(result)