結果

問題 No.2639 Longest Increasing Walk
ユーザー nikoro256nikoro256
提出日時 2024-02-19 21:37:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 459 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 123,380 KB
最終ジャッジ日時 2024-02-19 21:38:04
合計ジャッジ時間 6,583 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,460 KB
testcase_01 AC 31 ms
53,460 KB
testcase_02 AC 32 ms
53,460 KB
testcase_03 AC 31 ms
53,460 KB
testcase_04 AC 200 ms
118,644 KB
testcase_05 AC 183 ms
121,460 KB
testcase_06 AC 237 ms
122,996 KB
testcase_07 AC 313 ms
123,124 KB
testcase_08 AC 213 ms
123,252 KB
testcase_09 AC 359 ms
123,380 KB
testcase_10 AC 427 ms
100,496 KB
testcase_11 AC 363 ms
91,124 KB
testcase_12 AC 119 ms
78,912 KB
testcase_13 AC 459 ms
106,996 KB
testcase_14 AC 266 ms
92,800 KB
testcase_15 AC 33 ms
53,460 KB
testcase_16 AC 65 ms
68,776 KB
testcase_17 AC 195 ms
92,660 KB
testcase_18 AC 303 ms
96,512 KB
testcase_19 AC 113 ms
80,640 KB
testcase_20 AC 191 ms
81,024 KB
testcase_21 AC 385 ms
90,296 KB
testcase_22 AC 158 ms
82,192 KB
testcase_23 AC 46 ms
64,080 KB
testcase_24 AC 49 ms
64,076 KB
testcase_25 AC 48 ms
66,704 KB
testcase_26 AC 32 ms
53,460 KB
testcase_27 AC 50 ms
66,700 KB
testcase_28 AC 31 ms
53,460 KB
testcase_29 AC 31 ms
53,460 KB
testcase_30 AC 30 ms
53,460 KB
testcase_31 AC 30 ms
53,460 KB
testcase_32 AC 30 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W=map(int,input().split())
A=[]
for _ in range(H):
    A.append(list(map(int,input().split())))
lis=[]
for i in range(H):
    for j in range(W):
        lis.append((A[i][j],i,j))
lis.sort(reverse=True)
d=[[1,0],[-1,0],[0,1],[0,-1]]
dp=[[1]*W for _ in range(H)]
for a,i,j in lis:
    for dx,dy in d:
        if 0<=i+dx<H and 0<=j+dy<W and A[i+dx][j+dy]>A[i][j]:
            dp[i][j]=max(dp[i+dx][j+dy]+1,dp[i][j])
ans=0
for i in range(H):
    ans=max(max(dp[i]),ans)
print(ans)
0