結果
問題 | 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 bisectn, k = map(int, input().split())x = list(map(int, input().split()))if n == 0:print(0)exit()dp = [0] * npre_max = [0] * ndp[0] = 1pre_max[0] = 1for i in range(1, n):target = x[i] - k# Find the rightmost index where x[j] <= targetj = bisect.bisect_right(x, target) - 1if j >= 0:current = pre_max[j] + 1else:current = 1dp[i] = currentpre_max[i] = max(pre_max[i-1], current)print(pre_max[-1])