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