結果
問題 | No.2639 Longest Increasing Walk |
ユーザー |
![]() |
提出日時 | 2024-02-19 22:38:25 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 606 bytes |
コンパイル時間 | 245 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 28,068 KB |
最終ジャッジ日時 | 2024-09-29 02:29:29 |
合計ジャッジ時間 | 4,993 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 TLE * 1 -- * 27 |
ソースコード
from collections import dequeH,W = map(int, input().split())A = [ list(map(int, input().split())) for _ in range(H) ]dx=[0,1,0,-1]dy=[1,0,-1,0]def dfs(vx,vy,walk):global ansans = max(ans, walk)for x,y in zip(dx,dy):vvx = vx+xvvy = vy+yif not (0<=vvx<H) or not (0<=vvy<W):continueif (vvx,vvy) in seen:continueif A[vvx][vvy]>A[vx][vy]:dfs(vvx,vvy,walk+1)else:continueglobal ansans = 0for i in range(H):for j in range(W):seen = set()dfs(i,j,1)print(ans)