結果

問題 No.8046 yukicoderの過去問
ユーザー mlihua09
提出日時 2020-08-23 16:27:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 433 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 40,228 KB
最終ジャッジ日時 2024-10-15 18:44:10
合計ジャッジ時間 4,183 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 TLE * 1 -- * 2
権限があれば一括ダウンロードができます

ソースコード

diff #


K = int(input())

N = int(input())

X = list(map(int, input().split()))

import sys

sys.setrecursionlimit(10 ** 9)

P = 10 ** 9 + 7

note = [1] + [-1] * K

import bisect

def main(x):
    
    if note[x] != -1:
        
        return note[x]
        
    note[x] = 0
    
    for i in range(bisect.bisect(X, x)):
        
        note[x] += main(x - X[i])
        
        note[x] %= P
    
    return note[x]
    
print(main(K))
0