結果
| 問題 |
No.1703 Much Matching
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 15:32:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 559 bytes |
| コンパイル時間 | 634 ms |
| コンパイル使用メモリ | 81,536 KB |
| 実行使用メモリ | 177,580 KB |
| 最終ジャッジ日時 | 2025-04-16 15:37:21 |
| 合計ジャッジ時間 | 20,628 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 TLE * 1 -- * 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 ascending (b descending)
pairs.sort()
# Extract the y values in the sorted order, converting back to original values
ys = [-b for a, b in pairs]
# Compute the length of the longest strictly increasing subsequence
tails = []
for y in ys:
idx = bisect.bisect_left(tails, y)
if idx == len(tails):
tails.append(y)
else:
tails[idx] = y
print(len(tails))
lam6er