結果
問題 | No.1703 Much Matching |
ユーザー |
![]() |
提出日時 | 2025-04-15 21:21:46 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 539 bytes |
コンパイル時間 | 335 ms |
コンパイル使用メモリ | 82,712 KB |
実行使用メモリ | 152,988 KB |
最終ジャッジ日時 | 2025-04-15 21:27:58 |
合計ジャッジ時間 | 23,185 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 TLE * 2 -- * 1 |
ソースコード
import bisect n, m, q = map(int, input().split()) pairs = [] for _ in range(q): a, b = map(int, input().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 (female indices) b_list = [b for a, b in pairs] # Compute the length of the longest increasing subsequence tails = [] for num in b_list: idx = bisect.bisect_left(tails, num) if idx == len(tails): tails.append(num) else: tails[idx] = num print(len(tails))