結果

問題 No.2639 Longest Increasing Walk
ユーザー miho-4miho-4
提出日時 2024-02-19 22:30:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 470 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 121,844 KB
最終ジャッジ日時 2024-02-19 22:31:00
合計ジャッジ時間 7,266 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 32 ms
53,460 KB
testcase_03 AC 32 ms
53,460 KB
testcase_04 AC 188 ms
118,772 KB
testcase_05 AC 203 ms
121,716 KB
testcase_06 AC 211 ms
121,844 KB
testcase_07 AC 360 ms
121,844 KB
testcase_08 AC 232 ms
121,844 KB
testcase_09 AC 424 ms
121,844 KB
testcase_10 AC 460 ms
100,928 KB
testcase_11 AC 414 ms
91,276 KB
testcase_12 AC 101 ms
78,780 KB
testcase_13 AC 470 ms
107,124 KB
testcase_14 AC 275 ms
92,800 KB
testcase_15 AC 32 ms
53,460 KB
testcase_16 AC 59 ms
70,728 KB
testcase_17 AC 217 ms
92,660 KB
testcase_18 AC 315 ms
96,384 KB
testcase_19 AC 118 ms
80,504 KB
testcase_20 AC 203 ms
81,280 KB
testcase_21 AC 413 ms
90,592 KB
testcase_22 AC 191 ms
81,936 KB
testcase_23 AC 44 ms
63,932 KB
testcase_24 AC 42 ms
61,984 KB
testcase_25 AC 52 ms
66,544 KB
testcase_26 AC 32 ms
53,460 KB
testcase_27 AC 54 ms
69,156 KB
testcase_28 AC 33 ms
53,460 KB
testcase_29 AC 32 ms
53,460 KB
testcase_30 AC 34 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())
L=[list(map(int,input().split())) for _ in range(H)]
q=[]
for h in range(H):
  for w in range(W):
    q.append((L[h][w],h,w))
dp=[[1]*W for _ in range(H)]
q.sort()
dhw=[(1,0),(-1,0),(0,1),(0,-1)]
ans=1
for x,h,w in q:
  for dh,dw in dhw:
    if 0<=h+dh<H and 0<=w+dw<W and L[h][w]<L[h+dh][w+dw]:
      dp[h+dh][w+dw]=max(dp[h+dh][w+dw],dp[h][w]+1)
      if ans<dp[h+dh][w+dw]:
        ans=dp[h+dh][w+dw]
print(ans)
0