結果

問題 No.1703 Much Matching
ユーザー 👑 H20H20
提出日時 2021-10-08 23:33:14
言語 PyPy3
(7.3.13)
結果
TLE  
実行時間 -
コード長 674 bytes
コンパイル時間 1,860 ms
コンパイル使用メモリ 86,704 KB
実行使用メモリ 374,480 KB
最終ジャッジ日時 2023-09-30 13:43:59
合計ジャッジ時間 22,099 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,396 KB
testcase_01 AC 74 ms
71,540 KB
testcase_02 AC 76 ms
71,444 KB
testcase_03 AC 78 ms
71,336 KB
testcase_04 AC 81 ms
75,416 KB
testcase_05 AC 78 ms
75,244 KB
testcase_06 AC 840 ms
149,244 KB
testcase_07 AC 122 ms
78,440 KB
testcase_08 AC 943 ms
166,044 KB
testcase_09 AC 1,068 ms
177,264 KB
testcase_10 AC 198 ms
85,988 KB
testcase_11 AC 259 ms
91,696 KB
testcase_12 AC 121 ms
78,708 KB
testcase_13 AC 406 ms
104,448 KB
testcase_14 AC 106 ms
78,032 KB
testcase_15 AC 233 ms
89,020 KB
testcase_16 AC 537 ms
113,684 KB
testcase_17 AC 647 ms
128,980 KB
testcase_18 AC 106 ms
77,712 KB
testcase_19 AC 1,425 ms
219,824 KB
testcase_20 AC 217 ms
88,364 KB
testcase_21 AC 1,686 ms
253,236 KB
testcase_22 AC 613 ms
123,684 KB
testcase_23 AC 467 ms
110,880 KB
testcase_24 AC 103 ms
77,668 KB
testcase_25 AC 138 ms
79,960 KB
testcase_26 AC 357 ms
99,360 KB
testcase_27 AC 696 ms
139,244 KB
testcase_28 AC 1,392 ms
210,732 KB
testcase_29 AC 294 ms
96,220 KB
testcase_30 AC 379 ms
99,180 KB
testcase_31 AC 115 ms
79,156 KB
testcase_32 AC 718 ms
138,356 KB
testcase_33 AC 495 ms
114,920 KB
testcase_34 AC 127 ms
78,756 KB
testcase_35 AC 183 ms
84,696 KB
testcase_36 TLE -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect
from sys import stdin

def main():
    readline = stdin.readline
    # N: 数列の長さ
    # A[i]: a_i の値
    def solve(N, A):
        INF = 10**10

        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)

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

    print(solve(N,H))

main()
0