結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 33 ms
53,460 KB
testcase_02 AC 33 ms
53,460 KB
testcase_03 AC 33 ms
53,460 KB
testcase_04 AC 171 ms
116,880 KB
testcase_05 AC 200 ms
117,580 KB
testcase_06 AC 208 ms
117,348 KB
testcase_07 AC 327 ms
117,040 KB
testcase_08 AC 207 ms
117,848 KB
testcase_09 AC 353 ms
118,196 KB
testcase_10 AC 419 ms
97,648 KB
testcase_11 AC 384 ms
99,952 KB
testcase_12 AC 97 ms
74,036 KB
testcase_13 AC 447 ms
102,404 KB
testcase_14 AC 258 ms
92,668 KB
testcase_15 AC 31 ms
53,460 KB
testcase_16 AC 48 ms
66,672 KB
testcase_17 AC 192 ms
92,656 KB
testcase_18 AC 287 ms
96,380 KB
testcase_19 AC 109 ms
80,548 KB
testcase_20 AC 189 ms
82,696 KB
testcase_21 AC 405 ms
98,160 KB
testcase_22 AC 152 ms
84,212 KB
testcase_23 AC 43 ms
61,848 KB
testcase_24 AC 41 ms
61,840 KB
testcase_25 AC 48 ms
64,580 KB
testcase_26 AC 31 ms
53,460 KB
testcase_27 AC 46 ms
64,584 KB
testcase_28 AC 30 ms
53,460 KB
testcase_29 AC 37 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
#sys.setrecursionlimit((1<<19)-1)
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
input=sys.stdin.buffer.readline

H,W=map(int,input().split())
A=[list(map(int,input().split())) for i in range(H)]
p=[]
for i in range(H):
    for j in range(W):
        p.append((A[i][j],i,j))
p.sort()
dp=[[1]*(W) for i in range(H)]
for a,i,j in p:
    for dx,dy in [(0,1),(1,0),(0,-1),(-1,0)]:
        try:
            assert i+dx>=0
            assert j+dy>=0
            if a>A[i+dx][j+dy]:
                dp[i][j]=max(dp[i][j],dp[i+dx][j+dy]+1)
        except:
            pass
ans=0
for i in dp:
    ans=max(ans,max(i))
print(ans)
0