結果

問題 No.2639 Longest Increasing Walk
ユーザー tassei903tassei903
提出日時 2024-02-19 21:42:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 485 ms / 2,000 ms
コード長 697 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 125,812 KB
最終ジャッジ日時 2024-02-19 21:42:27
合計ジャッジ時間 6,625 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
53,460 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 34 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 175 ms
121,204 KB
testcase_05 AC 200 ms
125,428 KB
testcase_06 AC 217 ms
125,556 KB
testcase_07 AC 342 ms
125,300 KB
testcase_08 AC 234 ms
125,812 KB
testcase_09 AC 372 ms
125,812 KB
testcase_10 AC 435 ms
100,916 KB
testcase_11 AC 405 ms
96,196 KB
testcase_12 AC 88 ms
74,696 KB
testcase_13 AC 485 ms
107,764 KB
testcase_14 AC 260 ms
93,312 KB
testcase_15 AC 33 ms
53,460 KB
testcase_16 AC 49 ms
66,668 KB
testcase_17 AC 204 ms
93,428 KB
testcase_18 AC 326 ms
97,152 KB
testcase_19 AC 110 ms
80,616 KB
testcase_20 AC 197 ms
81,792 KB
testcase_21 AC 406 ms
97,572 KB
testcase_22 AC 161 ms
83,084 KB
testcase_23 AC 43 ms
61,856 KB
testcase_24 AC 42 ms
61,856 KB
testcase_25 AC 46 ms
64,580 KB
testcase_26 AC 32 ms
53,460 KB
testcase_27 AC 48 ms
64,588 KB
testcase_28 AC 31 ms
53,460 KB
testcase_29 AC 31 ms
53,460 KB
testcase_30 AC 31 ms
53,460 KB
testcase_31 AC 31 ms
53,460 KB
testcase_32 AC 31 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes")
no = lambda :print("no");No = lambda :print("No")
#######################################################################
h,w = na()
a = [na() for i in range(h)]

f = []
for i in range(h):
    for j in range(w):
        f.append((a[i][j],i,j))
f = sorted(f)
dp = [[0]*w for i in range(h)]

for x, i, j in f:
    for dx, dy in [(0,1),(1,0),(-1,0),(0,-1)]:
        ni,nj = i+dx,j+dy
        if 0<=ni<h and 0<=nj<w and a[i][j]>a[ni][nj]:
            dp[i][j] = max(dp[i][j],dp[ni][nj]+1)

print(max([max(i) for i in dp])+1)
0