結果

問題 No.1703 Much Matching
ユーザー 👑 H20H20
提出日時 2021-10-08 23:36:38
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 631 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 309,468 KB
最終ジャッジ日時 2023-09-30 13:50:17
合計ジャッジ時間 24,265 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
75,520 KB
testcase_01 AC 68 ms
71,424 KB
testcase_02 AC 70 ms
71,264 KB
testcase_03 AC 70 ms
71,260 KB
testcase_04 AC 76 ms
75,340 KB
testcase_05 AC 77 ms
75,384 KB
testcase_06 AC 1,112 ms
156,392 KB
testcase_07 AC 123 ms
79,960 KB
testcase_08 AC 1,168 ms
158,556 KB
testcase_09 AC 1,355 ms
170,920 KB
testcase_10 AC 225 ms
87,708 KB
testcase_11 AC 305 ms
94,112 KB
testcase_12 AC 121 ms
79,320 KB
testcase_13 AC 520 ms
109,404 KB
testcase_14 AC 100 ms
77,928 KB
testcase_15 AC 256 ms
90,208 KB
testcase_16 AC 706 ms
124,200 KB
testcase_17 AC 823 ms
132,604 KB
testcase_18 AC 102 ms
77,900 KB
testcase_19 AC 1,856 ms
207,396 KB
testcase_20 AC 260 ms
89,956 KB
testcase_21 TLE -
testcase_22 AC 798 ms
131,112 KB
testcase_23 AC 606 ms
116,912 KB
testcase_24 AC 98 ms
77,868 KB
testcase_25 AC 140 ms
80,524 KB
testcase_26 AC 411 ms
100,988 KB
testcase_27 AC 910 ms
139,148 KB
testcase_28 AC 1,764 ms
197,820 KB
testcase_29 AC 338 ms
95,892 KB
testcase_30 AC 519 ms
106,388 KB
testcase_31 AC 112 ms
79,156 KB
testcase_32 AC 915 ms
139,016 KB
testcase_33 AC 601 ms
114,732 KB
testcase_34 AC 125 ms
78,956 KB
testcase_35 AC 198 ms
86,032 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,key=lambda x:(x[0],-x[1]))
    H = []
    for w,h in WH:
        H.append(h)

    print(solve(N,H))

main()
0