結果
問題 |
No.686 Uncertain LIS
|
ユーザー |
![]() |
提出日時 | 2025-04-15 22:50:42 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 487 bytes |
コンパイル時間 | 232 ms |
コンパイル使用メモリ | 81,944 KB |
実行使用メモリ | 88,456 KB |
最終ジャッジ日時 | 2025-04-15 22:52:10 |
合計ジャッジ時間 | 6,770 ms |
ジャッジサーバーID (参考情報) |
judge2 / 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))