結果

問題 No.1703 Much Matching
ユーザー 👑 H20H20
提出日時 2021-10-08 23:40:44
言語 PyPy3
(7.3.13)
結果
TLE  
実行時間 -
コード長 551 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 229,552 KB
最終ジャッジ日時 2023-09-30 13:59:50
合計ジャッジ時間 25,879 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
75,952 KB
testcase_01 AC 73 ms
71,356 KB
testcase_02 AC 71 ms
71,504 KB
testcase_03 AC 71 ms
71,272 KB
testcase_04 AC 76 ms
75,332 KB
testcase_05 AC 74 ms
75,300 KB
testcase_06 AC 1,163 ms
156,276 KB
testcase_07 AC 129 ms
80,000 KB
testcase_08 AC 1,232 ms
158,404 KB
testcase_09 AC 1,413 ms
170,792 KB
testcase_10 AC 232 ms
87,716 KB
testcase_11 AC 320 ms
94,148 KB
testcase_12 AC 124 ms
79,044 KB
testcase_13 AC 537 ms
109,508 KB
testcase_14 AC 102 ms
77,884 KB
testcase_15 AC 265 ms
90,136 KB
testcase_16 AC 753 ms
124,368 KB
testcase_17 AC 867 ms
132,672 KB
testcase_18 AC 103 ms
77,980 KB
testcase_19 AC 1,933 ms
207,592 KB
testcase_20 AC 268 ms
89,796 KB
testcase_21 TLE -
testcase_22 AC 834 ms
130,752 KB
testcase_23 AC 625 ms
117,028 KB
testcase_24 AC 101 ms
78,160 KB
testcase_25 AC 142 ms
80,572 KB
testcase_26 AC 420 ms
101,244 KB
testcase_27 AC 938 ms
139,320 KB
testcase_28 AC 1,815 ms
197,736 KB
testcase_29 AC 344 ms
95,692 KB
testcase_30 AC 499 ms
106,372 KB
testcase_31 AC 113 ms
79,340 KB
testcase_32 AC 961 ms
139,120 KB
testcase_33 AC 627 ms
114,644 KB
testcase_34 AC 130 ms
79,108 KB
testcase_35 AC 204 ms
86,076 KB
testcase_36 TLE -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect
from sys import stdin

def solve(N, A):
    INF = 10**5

    dp = [INF]*(N+1)
    dp[0] = -1
    for a in A:
        idx = bisect(dp, a-1)
        dp[idx] = min(a, dp[idx])
    return max(i for i in range(N+1) if dp[i] < INF)

def main():
    readline = stdin.readline

    N,M,Q = map(int, readline().split())
    WH = []
    for _ in range(Q):
        WH.append(list(map(int,readline().split())))
    WH = sorted(WH,key=lambda x:(x[0],-x[1]))
    H = []
    for _,h in WH:
        H.append(h)

    print(solve(N,H))

main()
0