結果
| 問題 | 
                            No.1703 Much Matching
                             | 
                    
| コンテスト | |
| ユーザー | 
                             gew1fw
                         | 
                    
| 提出日時 | 2025-06-12 18:04:26 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 547 bytes | 
| コンパイル時間 | 287 ms | 
| コンパイル使用メモリ | 82,276 KB | 
| 実行使用メモリ | 146,600 KB | 
| 最終ジャッジ日時 | 2025-06-12 18:05:06 | 
| 合計ジャッジ時間 | 23,839 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 32 TLE * 2 -- * 1 | 
ソースコード
import sys
from bisect import bisect_left
n, m, q = map(int, sys.stdin.readline().split())
pairs = []
for _ in range(q):
    a, b = map(int, sys.stdin.readline().split())
    pairs.append((a, b))
# Sort by a ascending, then by b descending
pairs.sort(key=lambda x: (x[0], -x[1]))
# Extract the list of b's (women indices)
ys = [b for a, b in pairs]
# Compute the LIS in O(n log n) time
tails = []
for y in ys:
    idx = bisect_left(tails, y)
    if idx == len(tails):
        tails.append(y)
    else:
        tails[idx] = y
print(len(tails))
            
            
            
        
            
gew1fw