結果
| 問題 | 
                            No.1703 Much Matching
                             | 
                    
| コンテスト | |
| ユーザー | 
                             vwxyz
                         | 
                    
| 提出日時 | 2021-10-08 22:33:46 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 498 bytes | 
| コンパイル時間 | 476 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 145,892 KB | 
| 最終ジャッジ日時 | 2024-07-23 05:33:27 | 
| 合計ジャッジ時間 | 22,592 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 32 TLE * 2 -- * 1 | 
ソースコード
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)
    dp=[max_value]*N
    for x in lst:
        i=f(dp,x)
        dp[i]=x
    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()
B=[-b for a,b in AB]
inf=1<<30
ans=LIS(B,max_value=inf)
print(ans)
            
            
            
        
            
vwxyz