結果
| 問題 | No.686 Uncertain LIS | 
| コンテスト | |
| ユーザー |  gew1fw | 
| 提出日時 | 2025-06-12 18:33:49 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 452 bytes | 
| コンパイル時間 | 200 ms | 
| コンパイル使用メモリ | 82,616 KB | 
| 実行使用メモリ | 88,840 KB | 
| 最終ジャッジ日時 | 2025-06-12 18:33:57 | 
| 合計ジャッジ時間 | 6,564 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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))
            
            
            
        