結果
| 問題 |
No.3046 White Tiger vs Monster
|
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 16:16:47 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 640 bytes |
| コンパイル時間 | 278 ms |
| コンパイル使用メモリ | 82,952 KB |
| 実行使用メモリ | 130,660 KB |
| 最終ジャッジ日時 | 2025-06-12 16:18:21 |
| 合計ジャッジ時間 | 10,664 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 1 WA * 79 |
ソースコード
import bisect
MOD = 10**9 + 7
def main():
import sys
input = sys.stdin.read().split()
ptr = 0
K = int(input[ptr])
ptr +=1
N = int(input[ptr])
ptr +=1
x = list(map(int, input[ptr:ptr+N]))
ptr +=N
x.sort()
dp = [0]*(K+1)
dp[0] = 1
for i in range(1, K+1):
# 找到最大的x_j <=i
idx = bisect.bisect_right(x, i) - 1
# 遍历所有x_j <=i
for j in range(idx+1):
xj = x[j]
if xj > i:
break
dp[i] += dp[i - xj]
dp[i] %= MOD
print(dp[K] % MOD)
if __name__ == "__main__":
main()
gew1fw