結果

問題 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
コンパイル時間 165 ms
コンパイル使用メモリ 10,860 KB
実行使用メモリ 308,128 KB
最終ジャッジ日時 2023-09-30 14:18:13
合計ジャッジ時間 24,435 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,460 KB
testcase_01 AC 16 ms
7,960 KB
testcase_02 AC 17 ms
8,028 KB
testcase_03 AC 17 ms
8,076 KB
testcase_04 AC 17 ms
8,040 KB
testcase_05 AC 17 ms
8,020 KB
testcase_06 AC 1,162 ms
86,396 KB
testcase_07 AC 53 ms
11,980 KB
testcase_08 AC 1,248 ms
92,636 KB
testcase_09 AC 1,479 ms
104,968 KB
testcase_10 AC 147 ms
20,436 KB
testcase_11 AC 254 ms
27,948 KB
testcase_12 AC 46 ms
11,536 KB
testcase_13 AC 489 ms
43,948 KB
testcase_14 AC 25 ms
9,240 KB
testcase_15 AC 215 ms
24,364 KB
testcase_16 AC 699 ms
57,224 KB
testcase_17 AC 836 ms
65,672 KB
testcase_18 AC 23 ms
8,932 KB
testcase_19 TLE -
testcase_20 AC 175 ms
22,564 KB
testcase_21 TLE -
testcase_22 AC 824 ms
65,752 KB
testcase_23 AC 595 ms
49,896 KB
testcase_24 AC 23 ms
8,944 KB
testcase_25 AC 62 ms
13,064 KB
testcase_26 AC 361 ms
35,872 KB
testcase_27 AC 880 ms
70,192 KB
testcase_28 AC 1,957 ms
132,412 KB
testcase_29 AC 281 ms
29,932 KB
testcase_30 AC 451 ms
41,372 KB
testcase_31 AC 40 ms
10,780 KB
testcase_32 AC 944 ms
72,928 KB
testcase_33 AC 588 ms
51,024 KB
testcase_34 AC 45 ms
11,300 KB
testcase_35 AC 120 ms
18,416 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