結果

問題 No.1703 Much Matching
ユーザー Kiri8128Kiri8128
提出日時 2021-10-08 22:44:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 658 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 560 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 142,568 KB
最終ジャッジ日時 2023-09-30 11:47:20
合計ジャッジ時間 8,822 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,340 KB
testcase_01 AC 70 ms
71,396 KB
testcase_02 AC 71 ms
71,468 KB
testcase_03 AC 80 ms
76,528 KB
testcase_04 AC 81 ms
76,264 KB
testcase_05 AC 84 ms
76,544 KB
testcase_06 AC 235 ms
87,956 KB
testcase_07 AC 107 ms
77,676 KB
testcase_08 AC 250 ms
88,692 KB
testcase_09 AC 282 ms
90,728 KB
testcase_10 AC 121 ms
77,736 KB
testcase_11 AC 140 ms
78,888 KB
testcase_12 AC 108 ms
77,760 KB
testcase_13 AC 166 ms
79,836 KB
testcase_14 AC 100 ms
77,024 KB
testcase_15 AC 135 ms
78,224 KB
testcase_16 AC 185 ms
82,464 KB
testcase_17 AC 209 ms
84,572 KB
testcase_18 AC 99 ms
76,912 KB
testcase_19 AC 328 ms
100,692 KB
testcase_20 AC 123 ms
77,908 KB
testcase_21 AC 384 ms
105,448 KB
testcase_22 AC 203 ms
82,620 KB
testcase_23 AC 178 ms
81,328 KB
testcase_24 AC 97 ms
77,068 KB
testcase_25 AC 111 ms
77,900 KB
testcase_26 AC 154 ms
78,856 KB
testcase_27 AC 215 ms
84,456 KB
testcase_28 AC 325 ms
97,580 KB
testcase_29 AC 142 ms
78,872 KB
testcase_30 AC 158 ms
79,884 KB
testcase_31 AC 111 ms
77,840 KB
testcase_32 AC 215 ms
84,308 KB
testcase_33 AC 181 ms
81,032 KB
testcase_34 AC 105 ms
77,712 KB
testcase_35 AC 123 ms
78,272 KB
testcase_36 AC 658 ms
142,568 KB
testcase_37 AC 99 ms
77,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, Q = map(int, input().split())
X = [[] for _ in range(N)]
for _ in range(Q):
    a, b = map(int, input().split())
    X[a-1].append(b - 1)

Y = [0] * (M + 1)
for i, x in enumerate(X):
    nY = Y[:]
    for b in x:
        nY[b+1] = max(nY[b+1], Y[b] + 1)
    Y = nY
    for i in range(M):
        Y[i+1] = max(Y[i+1], Y[i])
print(max(Y))
0