結果
| 問題 |
No.686 Uncertain LIS
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 22:48:55 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 528 bytes |
| コンパイル時間 | 436 ms |
| コンパイル使用メモリ | 81,544 KB |
| 実行使用メモリ | 88,324 KB |
| 最終ジャッジ日時 | 2025-04-15 22:51:04 |
| 合計ジャッジ時間 | 5,941 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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