結果

問題 No.1703 Much Matching
ユーザー roarisroaris
提出日時 2021-10-23 20:51:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 506 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 1,655 ms
コンパイル使用メモリ 81,672 KB
実行使用メモリ 89,908 KB
最終ジャッジ日時 2023-10-26 04:13:08
合計ジャッジ時間 11,672 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,536 KB
testcase_01 AC 43 ms
55,536 KB
testcase_02 AC 44 ms
55,536 KB
testcase_03 AC 69 ms
70,328 KB
testcase_04 AC 63 ms
68,276 KB
testcase_05 AC 96 ms
84,316 KB
testcase_06 AC 180 ms
79,216 KB
testcase_07 AC 65 ms
72,692 KB
testcase_08 AC 222 ms
86,840 KB
testcase_09 AC 216 ms
80,384 KB
testcase_10 AC 93 ms
77,140 KB
testcase_11 AC 115 ms
82,020 KB
testcase_12 AC 69 ms
72,632 KB
testcase_13 AC 135 ms
80,796 KB
testcase_14 AC 63 ms
68,516 KB
testcase_15 AC 126 ms
85,648 KB
testcase_16 AC 136 ms
79,288 KB
testcase_17 AC 149 ms
78,188 KB
testcase_18 AC 59 ms
66,468 KB
testcase_19 AC 243 ms
79,836 KB
testcase_20 AC 82 ms
76,364 KB
testcase_21 AC 284 ms
82,696 KB
testcase_22 AC 176 ms
81,124 KB
testcase_23 AC 146 ms
78,784 KB
testcase_24 AC 61 ms
68,512 KB
testcase_25 AC 86 ms
78,744 KB
testcase_26 AC 144 ms
81,024 KB
testcase_27 AC 160 ms
78,320 KB
testcase_28 AC 279 ms
82,800 KB
testcase_29 AC 122 ms
80,832 KB
testcase_30 AC 135 ms
82,340 KB
testcase_31 AC 75 ms
73,732 KB
testcase_32 AC 180 ms
84,344 KB
testcase_33 AC 159 ms
81,380 KB
testcase_34 AC 71 ms
72,632 KB
testcase_35 AC 94 ms
77,436 KB
testcase_36 AC 506 ms
89,116 KB
testcase_37 AC 113 ms
89,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N, M, Q = map(int, input().split())
ok = [[False]*(M+1) for _ in range(N+1)]

for _ in range(Q):
    a, b = map(int, input().split())
    ok[a][b] = True

dp = [[0]*(M+1) for _ in range(N+1)]

for i in range(1, N+1):
    for j in range(1, M+1):
        dp[i][j] = max(dp[i][j], dp[i-1][j], dp[i][j-1], dp[i-1][j-1])
        
        if ok[i][j]:
            dp[i][j] = max(dp[i][j], dp[i-1][j-1]+1)

print(dp[N][M])
0