結果

問題 No.1703 Much Matching
ユーザー 👑 H20H20
提出日時 2021-10-08 23:29:37
言語 PyPy3
(7.3.13)
結果
TLE  
実行時間 -
コード長 516 bytes
コンパイル時間 1,299 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 254,684 KB
最終ジャッジ日時 2023-09-30 13:34:44
合計ジャッジ時間 21,929 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,132 KB
testcase_01 AC 75 ms
71,164 KB
testcase_02 AC 70 ms
71,420 KB
testcase_03 AC 71 ms
71,240 KB
testcase_04 AC 79 ms
75,448 KB
testcase_05 AC 76 ms
75,400 KB
testcase_06 AC 891 ms
154,484 KB
testcase_07 AC 140 ms
79,380 KB
testcase_08 AC 950 ms
160,516 KB
testcase_09 AC 1,073 ms
164,792 KB
testcase_10 AC 218 ms
86,176 KB
testcase_11 AC 283 ms
91,840 KB
testcase_12 AC 136 ms
79,140 KB
testcase_13 AC 444 ms
102,488 KB
testcase_14 AC 118 ms
78,264 KB
testcase_15 AC 266 ms
90,064 KB
testcase_16 AC 577 ms
119,412 KB
testcase_17 AC 692 ms
135,948 KB
testcase_18 AC 118 ms
78,248 KB
testcase_19 AC 1,454 ms
211,752 KB
testcase_20 AC 238 ms
88,200 KB
testcase_21 AC 1,759 ms
254,684 KB
testcase_22 AC 637 ms
120,880 KB
testcase_23 AC 525 ms
115,676 KB
testcase_24 AC 114 ms
78,152 KB
testcase_25 AC 150 ms
79,960 KB
testcase_26 AC 385 ms
102,140 KB
testcase_27 AC 735 ms
143,172 KB
testcase_28 AC 1,430 ms
209,120 KB
testcase_29 AC 313 ms
94,228 KB
testcase_30 AC 426 ms
105,840 KB
testcase_31 AC 123 ms
78,232 KB
testcase_32 AC 759 ms
141,880 KB
testcase_33 AC 525 ms
114,368 KB
testcase_34 AC 139 ms
79,292 KB
testcase_35 AC 209 ms
86,036 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