結果

問題 No.1703 Much Matching
ユーザー mink1618033mink1618033
提出日時 2021-10-09 19:25:27
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 499 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 166,756 KB
最終ジャッジ日時 2023-10-11 07:57:44
合計ジャッジ時間 28,288 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,468 KB
testcase_01 AC 74 ms
71,156 KB
testcase_02 AC 75 ms
71,344 KB
testcase_03 AC 75 ms
71,160 KB
testcase_04 AC 81 ms
75,500 KB
testcase_05 AC 79 ms
75,124 KB
testcase_06 AC 1,140 ms
124,988 KB
testcase_07 AC 133 ms
79,664 KB
testcase_08 AC 1,206 ms
127,000 KB
testcase_09 AC 1,396 ms
134,836 KB
testcase_10 AC 231 ms
85,368 KB
testcase_11 AC 319 ms
89,024 KB
testcase_12 AC 129 ms
78,944 KB
testcase_13 AC 531 ms
99,456 KB
testcase_14 AC 105 ms
78,080 KB
testcase_15 AC 265 ms
86,848 KB
testcase_16 AC 745 ms
108,152 KB
testcase_17 AC 865 ms
113,188 KB
testcase_18 AC 105 ms
77,616 KB
testcase_19 AC 1,895 ms
152,420 KB
testcase_20 AC 264 ms
86,424 KB
testcase_21 TLE -
testcase_22 AC 818 ms
111,896 KB
testcase_23 AC 623 ms
102,792 KB
testcase_24 AC 101 ms
77,340 KB
testcase_25 AC 144 ms
80,516 KB
testcase_26 AC 412 ms
93,932 KB
testcase_27 AC 921 ms
116,460 KB
testcase_28 AC 1,813 ms
149,332 KB
testcase_29 AC 345 ms
90,484 KB
testcase_30 AC 487 ms
97,376 KB
testcase_31 AC 120 ms
78,968 KB
testcase_32 AC 930 ms
116,296 KB
testcase_33 AC 607 ms
101,848 KB
testcase_34 AC 126 ms
79,268 KB
testcase_35 AC 205 ms
83,920 KB
testcase_36 TLE -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
import bisect

n,m,q = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(q)]

ab.sort(key=lambda x:(x[0],-x[1]))

def LIS(lst,weakly=False,max_value=float('inf')):
    f=bisect.bisect_right if weakly else bisect.bisect_left
    dp=[max_value]*(min(n,m)+1)
    for x in lst:
        i=f(dp,x)
        dp[i]=x
    res=bisect.bisect_left(dp,max_value)
    return res

inf=1<<30
bl = [b for a,b in ab]
ans=LIS(bl,max_value=inf)
print(ans)
0