結果

問題 No.1703 Much Matching
ユーザー H3PO4H3PO4
提出日時 2021-10-08 22:40:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 460 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 89,056 KB
最終ジャッジ日時 2023-09-30 11:41:06
合計ジャッジ時間 7,860 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,204 KB
testcase_01 AC 69 ms
71,440 KB
testcase_02 AC 70 ms
71,340 KB
testcase_03 AC 83 ms
76,240 KB
testcase_04 AC 89 ms
76,348 KB
testcase_05 AC 90 ms
76,416 KB
testcase_06 AC 182 ms
80,664 KB
testcase_07 AC 96 ms
78,188 KB
testcase_08 AC 214 ms
83,296 KB
testcase_09 AC 224 ms
83,208 KB
testcase_10 AC 110 ms
78,360 KB
testcase_11 AC 127 ms
80,472 KB
testcase_12 AC 96 ms
78,496 KB
testcase_13 AC 140 ms
79,816 KB
testcase_14 AC 87 ms
76,392 KB
testcase_15 AC 131 ms
82,452 KB
testcase_16 AC 142 ms
79,212 KB
testcase_17 AC 166 ms
79,496 KB
testcase_18 AC 86 ms
76,664 KB
testcase_19 AC 229 ms
81,180 KB
testcase_20 AC 101 ms
77,448 KB
testcase_21 AC 268 ms
82,052 KB
testcase_22 AC 185 ms
82,628 KB
testcase_23 AC 150 ms
82,068 KB
testcase_24 AC 86 ms
76,540 KB
testcase_25 AC 101 ms
79,004 KB
testcase_26 AC 151 ms
85,936 KB
testcase_27 AC 162 ms
79,604 KB
testcase_28 AC 274 ms
84,256 KB
testcase_29 AC 133 ms
80,784 KB
testcase_30 AC 144 ms
80,544 KB
testcase_31 AC 102 ms
80,272 KB
testcase_32 AC 192 ms
86,012 KB
testcase_33 AC 180 ms
83,336 KB
testcase_34 AC 97 ms
78,084 KB
testcase_35 AC 111 ms
78,556 KB
testcase_36 AC 460 ms
87,720 KB
testcase_37 AC 126 ms
89,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.buffer.readline

N, M, Q = map(int, input().split())

matr = [[False] * M for _ in range(N)]
for _ in range(Q):
    a, b = (int(x) - 1 for x in input().split())
    matr[a][b] = True

dp = [[0] * (M + 1) for _ in range(N + 1)]
for a in range(N):
    for b in range(M):
        if matr[a][b]:
            dp[a + 1][b + 1] = max(dp[a][b] + 1, dp[a + 1][b], dp[a][b + 1])
        else:
            dp[a + 1][b + 1] = max(dp[a + 1][b], dp[a][b + 1])
print(dp[-1][-1])
0