結果

問題 No.1703 Much Matching
ユーザー mkawa2mkawa2
提出日時 2021-10-09 08:26:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 885 ms / 2,000 ms
コード長 1,051 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 228,092 KB
最終ジャッジ日時 2023-10-01 03:04:18
合計ジャッジ時間 10,529 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,616 KB
testcase_01 AC 92 ms
71,564 KB
testcase_02 AC 91 ms
71,312 KB
testcase_03 AC 114 ms
78,264 KB
testcase_04 AC 116 ms
77,508 KB
testcase_05 AC 125 ms
78,092 KB
testcase_06 AC 281 ms
106,556 KB
testcase_07 AC 127 ms
79,260 KB
testcase_08 AC 334 ms
113,172 KB
testcase_09 AC 329 ms
113,908 KB
testcase_10 AC 138 ms
79,048 KB
testcase_11 AC 163 ms
80,300 KB
testcase_12 AC 120 ms
78,960 KB
testcase_13 AC 189 ms
86,184 KB
testcase_14 AC 114 ms
77,488 KB
testcase_15 AC 167 ms
80,756 KB
testcase_16 AC 215 ms
92,136 KB
testcase_17 AC 239 ms
96,432 KB
testcase_18 AC 111 ms
77,752 KB
testcase_19 AC 387 ms
133,680 KB
testcase_20 AC 133 ms
80,532 KB
testcase_21 AC 455 ms
143,000 KB
testcase_22 AC 246 ms
95,756 KB
testcase_23 AC 207 ms
87,572 KB
testcase_24 AC 113 ms
77,528 KB
testcase_25 AC 127 ms
78,536 KB
testcase_26 AC 199 ms
84,352 KB
testcase_27 AC 241 ms
98,244 KB
testcase_28 AC 405 ms
130,724 KB
testcase_29 AC 176 ms
82,404 KB
testcase_30 AC 189 ms
86,276 KB
testcase_31 AC 126 ms
77,980 KB
testcase_32 AC 258 ms
103,848 KB
testcase_33 AC 223 ms
95,736 KB
testcase_34 AC 123 ms
78,684 KB
testcase_35 AC 141 ms
79,100 KB
testcase_36 AC 885 ms
228,092 KB
testcase_37 AC 142 ms
77,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (1, 0), (0, -1), (-1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**19
# md = 998244353
md = 10**9+7

from collections import defaultdict

n, m, q = LI()

itoj = defaultdict(set)

for _ in range(q):
    a, b = LI1()
    itoj[a].add(b)

dp = [[0]*(m+1) for _ in range(n+1)]

for i in range(n):
    for j in range(m):
        if j in itoj[i]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1)
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])
# p2D(dp)

print(dp[-1][-1])
0