結果

問題 No.1668 Grayscale
ユーザー 👑 KazunKazun
提出日時 2021-09-13 20:31:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 555 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 205,376 KB
最終ジャッジ日時 2023-09-08 04:14:14
合計ジャッジ時間 7,774 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 68 ms
71,428 KB
testcase_02 AC 68 ms
71,432 KB
testcase_03 AC 69 ms
71,608 KB
testcase_04 WA -
testcase_05 AC 68 ms
71,440 KB
testcase_06 WA -
testcase_07 AC 499 ms
204,956 KB
testcase_08 AC 311 ms
159,752 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 73 ms
71,548 KB
testcase_19 AC 74 ms
71,352 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 75 ms
71,328 KB
testcase_23 AC 76 ms
71,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#==================================================
from itertools import product
H,W,N=map(int,input().split())
C=[]
for _ in range(H):
    C.append(list(map(int,input().split())))

T=[(1,0),(0,1)]
E=[[] for _ in range(N+1)]
for i,j in product(range(H),range(W)):
    for a,b in T:
        if 0<=i+a<H and 0<=j+b<W:
            alpha=min(C[i][j],C[i+a][j+b])
            beta =max(C[i][j],C[i+a][j+b])
            E[alpha].append(beta)

DP=[0]*(N+1)
for x in range(N,0,-1):
    m=0
    for y in E[x]:
        m=max(m,DP[y])
    DP[x]=m+1

print(max(DP))
0