結果

問題 No.1703 Much Matching
ユーザー 👑 KazunKazun
提出日時 2021-10-08 22:16:55
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 419 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 91,080 KB
最終ジャッジ日時 2023-09-30 10:38:47
合計ジャッジ時間 7,102 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,232 KB
testcase_01 AC 67 ms
71,344 KB
testcase_02 AC 69 ms
71,320 KB
testcase_03 AC 79 ms
76,224 KB
testcase_04 AC 81 ms
76,188 KB
testcase_05 AC 79 ms
76,528 KB
testcase_06 AC 170 ms
80,164 KB
testcase_07 AC 88 ms
76,728 KB
testcase_08 AC 203 ms
87,684 KB
testcase_09 AC 203 ms
81,212 KB
testcase_10 AC 103 ms
78,200 KB
testcase_11 AC 119 ms
83,324 KB
testcase_12 AC 88 ms
76,548 KB
testcase_13 AC 131 ms
81,648 KB
testcase_14 AC 87 ms
76,432 KB
testcase_15 AC 117 ms
86,608 KB
testcase_16 AC 134 ms
78,812 KB
testcase_17 AC 154 ms
79,116 KB
testcase_18 AC 85 ms
76,332 KB
testcase_19 AC 218 ms
80,716 KB
testcase_20 AC 99 ms
77,308 KB
testcase_21 AC 255 ms
83,720 KB
testcase_22 AC 163 ms
81,980 KB
testcase_23 AC 142 ms
79,792 KB
testcase_24 AC 83 ms
76,320 KB
testcase_25 AC 99 ms
79,908 KB
testcase_26 AC 128 ms
82,340 KB
testcase_27 AC 157 ms
79,380 KB
testcase_28 AC 242 ms
83,976 KB
testcase_29 AC 121 ms
81,596 KB
testcase_30 AC 133 ms
83,400 KB
testcase_31 AC 90 ms
76,900 KB
testcase_32 AC 169 ms
85,560 KB
testcase_33 AC 152 ms
82,464 KB
testcase_34 AC 89 ms
76,636 KB
testcase_35 AC 103 ms
78,876 KB
testcase_36 AC 419 ms
89,844 KB
testcase_37 AC 105 ms
91,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input=sys.stdin.readline
N,M,Q=map(int,input().split())
E=[[0]*(M+1) for _ in range(N+1)]

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

DP=[[0]*(M+1) for _ in range(N+1)]
for i in range(1,N+1):
    D=DP[i]; DD=DP[i-1]
    e=E[i]
    for j in range(1,M+1):
        if e[j]==0:
            D[j]=max(D[j-1], DD[j])
        else:
            D[j]=max(D[j-1], DD[j], DD[j-1]+1)

print(DP[N][M])
0