結果

問題 No.1703 Much Matching
ユーザー H20H20
提出日時 2021-10-08 23:50:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 551 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 313,080 KB
最終ジャッジ日時 2024-07-23 08:21:17
合計ジャッジ時間 25,392 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
17,692 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 31 ms
10,880 KB
testcase_05 AC 31 ms
10,624 KB
testcase_06 AC 1,243 ms
88,776 KB
testcase_07 AC 69 ms
14,464 KB
testcase_08 AC 1,379 ms
95,200 KB
testcase_09 AC 1,587 ms
107,320 KB
testcase_10 AC 177 ms
23,040 KB
testcase_11 AC 279 ms
30,584 KB
testcase_12 AC 63 ms
13,824 KB
testcase_13 AC 537 ms
46,372 KB
testcase_14 AC 38 ms
11,520 KB
testcase_15 AC 235 ms
27,108 KB
testcase_16 AC 744 ms
59,592 KB
testcase_17 AC 888 ms
68,160 KB
testcase_18 AC 38 ms
11,520 KB
testcase_19 TLE -
testcase_20 AC 204 ms
25,344 KB
testcase_21 TLE -
testcase_22 AC 912 ms
68,412 KB
testcase_23 AC 664 ms
52,572 KB
testcase_24 AC 38 ms
11,392 KB
testcase_25 AC 82 ms
15,488 KB
testcase_26 AC 411 ms
38,316 KB
testcase_27 AC 985 ms
72,740 KB
testcase_28 TLE -
testcase_29 AC 320 ms
32,504 KB
testcase_30 AC 493 ms
43,748 KB
testcase_31 AC 55 ms
13,312 KB
testcase_32 AC 991 ms
75,520 KB
testcase_33 AC 639 ms
53,700 KB
testcase_34 AC 60 ms
13,824 KB
testcase_35 AC 145 ms
20,864 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