結果

問題 No.1703 Much Matching
ユーザー vwxyzvwxyz
提出日時 2021-10-08 22:24:43
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 705 bytes
コンパイル時間 1,057 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 171,276 KB
最終ジャッジ日時 2023-09-30 10:52:28
合計ジャッジ時間 25,239 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,456 KB
testcase_01 AC 73 ms
71,348 KB
testcase_02 AC 73 ms
71,388 KB
testcase_03 AC 75 ms
71,428 KB
testcase_04 AC 80 ms
75,260 KB
testcase_05 AC 78 ms
75,396 KB
testcase_06 AC 1,100 ms
122,280 KB
testcase_07 AC 129 ms
79,276 KB
testcase_08 AC 1,150 ms
125,736 KB
testcase_09 AC 1,321 ms
133,704 KB
testcase_10 AC 219 ms
83,740 KB
testcase_11 AC 305 ms
87,296 KB
testcase_12 AC 121 ms
78,864 KB
testcase_13 AC 511 ms
96,708 KB
testcase_14 AC 99 ms
77,416 KB
testcase_15 AC 260 ms
85,988 KB
testcase_16 AC 699 ms
104,816 KB
testcase_17 AC 823 ms
111,672 KB
testcase_18 AC 98 ms
77,420 KB
testcase_19 AC 1,809 ms
156,428 KB
testcase_20 AC 248 ms
85,212 KB
testcase_21 TLE -
testcase_22 AC 770 ms
110,092 KB
testcase_23 AC 588 ms
101,236 KB
testcase_24 AC 96 ms
76,624 KB
testcase_25 AC 138 ms
79,356 KB
testcase_26 AC 394 ms
91,948 KB
testcase_27 AC 888 ms
113,380 KB
testcase_28 AC 1,734 ms
149,480 KB
testcase_29 AC 322 ms
88,284 KB
testcase_30 AC 475 ms
95,132 KB
testcase_31 AC 114 ms
78,132 KB
testcase_32 AC 894 ms
112,880 KB
testcase_33 AC 584 ms
100,120 KB
testcase_34 AC 121 ms
78,900 KB
testcase_35 AC 196 ms
82,484 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)
    lis=[None]*n
    n-=1
    for i,x in update[::-1]:
        if i==n:
            lis[n]=x
            n-=1
    return lis

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=len(LIS(B,max_value=inf))
print(ans)
0