結果

問題 No.1703 Much Matching
ユーザー vwxyzvwxyz
提出日時 2021-10-08 22:25:57
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 588 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 86,456 KB
実行使用メモリ 166,912 KB
最終ジャッジ日時 2023-09-30 10:55:31
合計ジャッジ時間 25,293 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,052 KB
testcase_01 AC 75 ms
71,064 KB
testcase_02 AC 75 ms
70,868 KB
testcase_03 AC 79 ms
70,992 KB
testcase_04 AC 84 ms
75,032 KB
testcase_05 AC 83 ms
74,976 KB
testcase_06 AC 1,085 ms
120,140 KB
testcase_07 AC 126 ms
78,864 KB
testcase_08 AC 1,130 ms
122,572 KB
testcase_09 AC 1,306 ms
130,944 KB
testcase_10 AC 220 ms
83,260 KB
testcase_11 AC 297 ms
86,924 KB
testcase_12 AC 117 ms
78,584 KB
testcase_13 AC 496 ms
95,584 KB
testcase_14 AC 98 ms
76,972 KB
testcase_15 AC 253 ms
85,224 KB
testcase_16 AC 690 ms
103,040 KB
testcase_17 AC 803 ms
108,920 KB
testcase_18 AC 92 ms
76,396 KB
testcase_19 AC 1,762 ms
152,968 KB
testcase_20 AC 240 ms
84,568 KB
testcase_21 TLE -
testcase_22 AC 768 ms
108,068 KB
testcase_23 AC 583 ms
100,064 KB
testcase_24 AC 93 ms
76,400 KB
testcase_25 AC 134 ms
78,984 KB
testcase_26 AC 389 ms
90,944 KB
testcase_27 AC 895 ms
111,224 KB
testcase_28 AC 1,734 ms
145,676 KB
testcase_29 AC 324 ms
87,404 KB
testcase_30 AC 473 ms
93,768 KB
testcase_31 AC 112 ms
78,052 KB
testcase_32 AC 927 ms
110,888 KB
testcase_33 AC 566 ms
98,976 KB
testcase_34 AC 125 ms
78,576 KB
testcase_35 AC 193 ms
82,272 KB
testcase_36 TLE -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import sys
readline=sys.stdin.readline

def LIS(lst,weakly=False,max_value=float('inf')):
    f=bisect.bisect_right if weakly else bisect.bisect_left
    N=len(lst)
    update=[None]*N
    dp=[max_value]*N
    for k,x in enumerate(lst):
        i=f(dp,x)
        dp[i]=x
        update[k]=(i,dp[i])
    n=bisect.bisect_left(dp,max_value)
    return n

N,M,Q=map(int,readline().split())
AB=[]
for _ in range(Q):
    a,b=map(int,readline().split())
    AB.append((a,b))
AB.sort(key=lambda tpl:(tpl[0],-tpl[1]))
B=[b for a,b in AB]
inf=1<<60
ans=LIS(B,max_value=inf)
print(ans)
0