結果
| 問題 |
No.3046 White Tiger vs Monster
|
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 15:58:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 466 bytes |
| コンパイル時間 | 204 ms |
| コンパイル使用メモリ | 81,872 KB |
| 実行使用メモリ | 66,720 KB |
| 最終ジャッジ日時 | 2025-04-16 16:00:41 |
| 合計ジャッジ時間 | 7,697 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 80 |
ソースコード
import bisect
MOD = 10**9 + 7
K = int(input())
N = int(input())
x = list(map(int, input().split()))
x.sort()
dp = [0] * (K + 1)
dp[0] = 1 # Base case: 0 steps, 1 way
for k in range(1, K + 1):
# Find the rightmost index where x[i] <= k
idx = bisect.bisect_right(x, k) - 1
total = 0
for i in range(idx + 1):
d = x[i]
if k - d >= 0:
total += dp[k - d]
total %= MOD
dp[k] = total % MOD
print(dp[K] % MOD)
lam6er