結果
| 問題 | No.686 Uncertain LIS | 
| コンテスト | |
| ユーザー |  lam6er | 
| 提出日時 | 2025-04-15 22:52:07 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 583 bytes | 
| コンパイル時間 | 339 ms | 
| コンパイル使用メモリ | 81,904 KB | 
| 実行使用メモリ | 79,596 KB | 
| 最終ジャッジ日時 | 2025-04-15 22:54:32 | 
| 合計ジャッジ時間 | 5,979 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 WA * 20 | 
ソースコード
import bisect
n = int(input())
tails = []
for _ in range(n):
    L, R = map(int, input().split())
    idx = bisect.bisect_left(tails, R)
    if idx == 0:
        x = L
        if x <= R:
            if not tails:
                tails.append(x)
            else:
                if x < tails[0]:
                    tails[0] = x
    else:
        k = idx - 1
        x = max(L, tails[k] + 1)
        if x > R:
            continue
        if idx >= len(tails):
            tails.append(x)
        else:
            if x < tails[idx]:
                tails[idx] = x
print(len(tails))
            
            
            
        