結果

問題 No.1703 Much Matching
ユーザー vwxyzvwxyz
提出日時 2021-10-08 22:26:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 588 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 237,536 KB
最終ジャッジ日時 2023-09-30 10:57:11
合計ジャッジ時間 24,258 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,180 KB
testcase_01 AC 17 ms
7,968 KB
testcase_02 AC 16 ms
7,980 KB
testcase_03 AC 16 ms
8,064 KB
testcase_04 AC 17 ms
8,020 KB
testcase_05 AC 17 ms
7,980 KB
testcase_06 AC 1,171 ms
68,064 KB
testcase_07 AC 55 ms
11,024 KB
testcase_08 AC 1,280 ms
73,912 KB
testcase_09 AC 1,462 ms
82,968 KB
testcase_10 AC 148 ms
17,396 KB
testcase_11 AC 244 ms
23,468 KB
testcase_12 AC 48 ms
10,800 KB
testcase_13 AC 485 ms
35,680 KB
testcase_14 AC 25 ms
8,984 KB
testcase_15 AC 207 ms
20,820 KB
testcase_16 AC 702 ms
46,084 KB
testcase_17 AC 835 ms
52,104 KB
testcase_18 AC 24 ms
8,784 KB
testcase_19 TLE -
testcase_20 AC 178 ms
19,216 KB
testcase_21 TLE -
testcase_22 AC 831 ms
53,096 KB
testcase_23 AC 580 ms
40,396 KB
testcase_24 AC 23 ms
8,896 KB
testcase_25 AC 64 ms
11,872 KB
testcase_26 AC 362 ms
29,704 KB
testcase_27 AC 899 ms
55,912 KB
testcase_28 AC 1,966 ms
105,484 KB
testcase_29 AC 282 ms
24,952 KB
testcase_30 AC 440 ms
33,724 KB
testcase_31 AC 41 ms
10,092 KB
testcase_32 AC 955 ms
58,800 KB
testcase_33 AC 580 ms
41,408 KB
testcase_34 AC 49 ms
10,712 KB
testcase_35 AC 129 ms
15,772 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