結果
問題 |
No.2757 Pin Game
|
ユーザー |
![]() |
提出日時 | 2025-03-20 21:06:52 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 210 ms / 2,000 ms |
コード長 | 479 bytes |
コンパイル時間 | 386 ms |
コンパイル使用メモリ | 82,576 KB |
実行使用メモリ | 132,536 KB |
最終ジャッジ日時 | 2025-03-20 21:06:55 |
合計ジャッジ時間 | 2,344 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 |
ソースコード
import bisect n, k = map(int, input().split()) x = list(map(int, input().split())) if n == 0: print(0) exit() dp = [0] * n pre_max = [0] * n dp[0] = 1 pre_max[0] = 1 for i in range(1, n): target = x[i] - k # Find the rightmost index where x[j] <= target j = bisect.bisect_right(x, target) - 1 if j >= 0: current = pre_max[j] + 1 else: current = 1 dp[i] = current pre_max[i] = max(pre_max[i-1], current) print(pre_max[-1])