結果
問題 |
No.686 Uncertain LIS
|
ユーザー |
![]() |
提出日時 | 2025-06-12 18:37:47 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 452 bytes |
コンパイル時間 | 191 ms |
コンパイル使用メモリ | 82,448 KB |
実行使用メモリ | 88,712 KB |
最終ジャッジ日時 | 2025-06-12 18:37:57 |
合計ジャッジ時間 | 6,778 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 WA * 20 |
ソースコード
import bisect n = int(input()) intervals = [tuple(map(int, input().split())) for _ in range(n)] dp = [] for L, R in intervals: idx = bisect.bisect_left(dp, R) - 1 if idx >= 0: candidate = max(dp[idx] + 1, L) else: candidate = L if candidate <= R: if idx + 1 < len(dp): if candidate < dp[idx + 1]: dp[idx + 1] = candidate else: dp.append(candidate) print(len(dp))