結果

問題 No.8046 yukicoderの過去問
ユーザー mlihua09
提出日時 2020-08-23 16:26:52
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 433 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 210,432 KB
最終ジャッジ日時 2024-10-15 18:44:06
合計ジャッジ時間 5,454 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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