結果

問題 No.1703 Much Matching
ユーザー H20H20
提出日時 2021-10-08 23:29:37
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 516 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 82,072 KB
実行使用メモリ 342,524 KB
最終ジャッジ日時 2024-07-23 07:37:02
合計ジャッジ時間 20,592 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
59,932 KB
testcase_01 AC 38 ms
52,888 KB
testcase_02 AC 38 ms
53,196 KB
testcase_03 AC 39 ms
52,728 KB
testcase_04 AC 50 ms
61,388 KB
testcase_05 AC 41 ms
59,004 KB
testcase_06 AC 894 ms
154,504 KB
testcase_07 AC 106 ms
78,228 KB
testcase_08 AC 964 ms
159,604 KB
testcase_09 AC 1,086 ms
163,764 KB
testcase_10 AC 198 ms
84,724 KB
testcase_11 AC 262 ms
90,788 KB
testcase_12 AC 110 ms
77,928 KB
testcase_13 AC 425 ms
104,012 KB
testcase_14 AC 89 ms
77,040 KB
testcase_15 AC 231 ms
86,844 KB
testcase_16 AC 579 ms
118,612 KB
testcase_17 AC 709 ms
135,116 KB
testcase_18 AC 89 ms
76,964 KB
testcase_19 AC 1,492 ms
210,088 KB
testcase_20 AC 216 ms
87,536 KB
testcase_21 AC 1,849 ms
253,712 KB
testcase_22 AC 644 ms
124,228 KB
testcase_23 AC 524 ms
116,808 KB
testcase_24 AC 83 ms
76,912 KB
testcase_25 AC 124 ms
78,996 KB
testcase_26 AC 362 ms
98,088 KB
testcase_27 AC 744 ms
134,992 KB
testcase_28 AC 1,541 ms
206,992 KB
testcase_29 AC 298 ms
94,728 KB
testcase_30 AC 417 ms
106,524 KB
testcase_31 AC 94 ms
77,028 KB
testcase_32 AC 772 ms
141,564 KB
testcase_33 AC 495 ms
105,948 KB
testcase_34 AC 107 ms
78,112 KB
testcase_35 AC 171 ms
83,940 KB
testcase_36 TLE -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect

# 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, input().split())
WH = []
for i in range(Q):
    WH.append(list(map(int,input().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))
0