結果
| 問題 | No.686 Uncertain LIS | 
| コンテスト | |
| ユーザー |  gew1fw | 
| 提出日時 | 2025-06-12 13:23:07 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 469 bytes | 
| コンパイル時間 | 1,230 ms | 
| コンパイル使用メモリ | 82,540 KB | 
| 実行使用メモリ | 84,844 KB | 
| 最終ジャッジ日時 | 2025-06-12 13:27:10 | 
| 合計ジャッジ時間 | 6,316 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 WA * 20 | 
ソースコード
import bisect
n = int(input())
intervals = []
for _ in range(n):
    L, R = map(int, input().split())
    intervals.append((L, R))
tails = []
for L, R in intervals:
    idx = bisect.bisect_left(tails, R)
    j_max = idx - 1
    if j_max >= 0:
        x = max(L, tails[j_max] + 1)
    else:
        x = L
    if x > R:
        continue
    if idx == len(tails):
        tails.append(x)
    else:
        if x < tails[idx]:
            tails[idx] = x
print(len(tails))
            
            
            
        