結果
| 問題 |
No.686 Uncertain LIS
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 15:56:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 528 bytes |
| コンパイル時間 | 698 ms |
| コンパイル使用メモリ | 81,956 KB |
| 実行使用メモリ | 88,576 KB |
| 最終ジャッジ日時 | 2025-04-16 15:58:47 |
| 合計ジャッジ時間 | 6,027 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / 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:
if not dp:
dp.append(L)
else:
pos = bisect.bisect_left(dp, R)
k_max = pos - 1
if k_max >= 0:
x = max(L, dp[k_max] + 1)
else:
x = L
new_length = k_max + 2
if new_length > len(dp):
dp.append(x)
else:
if x < dp[new_length - 1]:
dp[new_length - 1] = x
print(len(dp))
lam6er