結果
| 問題 | 
                            No.1703 Much Matching
                             | 
                    
| コンテスト | |
| ユーザー | 
                             mink1618033
                         | 
                    
| 提出日時 | 2021-10-09 19:27:12 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 502 bytes | 
| コンパイル時間 | 290 ms | 
| コンパイル使用メモリ | 82,340 KB | 
| 実行使用メモリ | 166,312 KB | 
| 最終ジャッジ日時 | 2024-09-13 07:01:30 | 
| 合計ジャッジ時間 | 24,352 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 32 TLE * 2 -- * 1 | 
ソースコード
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)
            
            
            
        
            
mink1618033