結果
問題 |
No.3046 White Tiger vs Monster
|
ユーザー |
![]() |
提出日時 | 2025-04-15 22:52:23 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 476 bytes |
コンパイル時間 | 283 ms |
コンパイル使用メモリ | 82,492 KB |
実行使用メモリ | 67,460 KB |
最終ジャッジ日時 | 2025-04-15 22:54:49 |
合計ジャッジ時間 | 7,113 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 80 |
ソースコード
MOD = 10**9 + 7 K = int(input()) N = int(input()) x = list(map(int, input().split())) x.sort(reverse=True) # Sort in descending order to break early dp = [0] * (K + 1) dp[0] = 1 # Base case: one way to stay at step 0 for k in range(1, K + 1): total = 0 for xi in x: if xi > k: continue # Skip steps larger than current k total += dp[k - xi] if total >= MOD: total -= MOD dp[k] = total % MOD print(dp[K] % MOD)