結果
| 問題 |
No.686 Uncertain LIS
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 15:56:11 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 487 bytes |
| コンパイル時間 | 619 ms |
| コンパイル使用メモリ | 81,704 KB |
| 実行使用メモリ | 88,320 KB |
| 最終ジャッジ日時 | 2025-04-16 15:58:41 |
| 合計ジャッジ時間 | 6,277 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:
# Find the largest index where dp[index] < R
idx = bisect.bisect_left(dp, R)
k = idx - 1
if k == -1:
x = L
else:
x = max(L, dp[k] + 1)
# Determine the new length
new_len = k + 2
if new_len > len(dp):
dp.append(x)
else:
if x < dp[new_len - 1]:
dp[new_len - 1] = x
print(len(dp))
lam6er