結果

問題 No.1703 Much Matching
ユーザー brthyyjpbrthyyjp
提出日時 2021-10-10 01:02:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 708 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 1,400 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 90,644 KB
最終ジャッジ日時 2023-10-11 16:41:26
合計ジャッジ時間 11,680 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,388 KB
testcase_01 AC 75 ms
71,536 KB
testcase_02 AC 73 ms
71,184 KB
testcase_03 AC 99 ms
76,276 KB
testcase_04 AC 99 ms
76,468 KB
testcase_05 AC 116 ms
85,404 KB
testcase_06 AC 277 ms
80,652 KB
testcase_07 AC 122 ms
77,704 KB
testcase_08 AC 310 ms
90,644 KB
testcase_09 AC 323 ms
86,264 KB
testcase_10 AC 139 ms
78,944 KB
testcase_11 AC 168 ms
83,756 KB
testcase_12 AC 116 ms
78,156 KB
testcase_13 AC 194 ms
79,804 KB
testcase_14 AC 110 ms
77,860 KB
testcase_15 AC 163 ms
82,328 KB
testcase_16 AC 211 ms
79,556 KB
testcase_17 AC 236 ms
79,800 KB
testcase_18 AC 108 ms
76,832 KB
testcase_19 AC 372 ms
85,252 KB
testcase_20 AC 131 ms
78,080 KB
testcase_21 AC 416 ms
83,944 KB
testcase_22 AC 246 ms
82,492 KB
testcase_23 AC 215 ms
83,052 KB
testcase_24 AC 106 ms
76,820 KB
testcase_25 AC 125 ms
78,700 KB
testcase_26 AC 192 ms
87,268 KB
testcase_27 AC 244 ms
82,320 KB
testcase_28 AC 384 ms
85,132 KB
testcase_29 AC 171 ms
83,084 KB
testcase_30 AC 192 ms
81,984 KB
testcase_31 AC 124 ms
79,032 KB
testcase_32 AC 257 ms
82,912 KB
testcase_33 AC 222 ms
85,592 KB
testcase_34 AC 116 ms
78,016 KB
testcase_35 AC 141 ms
80,776 KB
testcase_36 AC 708 ms
86,548 KB
testcase_37 AC 134 ms
87,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,q = map(int, input().split())
M = [[0]*m for i in range(n)]
for i in range(q):
    a,b = map(int, input().split())
    a,b =a-1, b-1
    M[a][b] = 1

dp = [[0]*(m+1) for i in range(n+1)]
for i in range(n):
    for j in range(m):
        if M[i][j] == 1:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])
print(dp[n][m])
0