結果

問題 No.1703 Much Matching
ユーザー mink1618033
提出日時 2021-10-09 19:28:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 82,100 KB
実行使用メモリ 242,048 KB
最終ジャッジ日時 2024-09-13 07:02:57
合計ジャッジ時間 23,896 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 32 TLE * 2 -- * 1
権限があれば一括ダウンロードができます

ソースコード

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=10**18)
#print(ans)
0