結果

問題 No.3046 yukicoderの過去問
ユーザー mlihua09mlihua09
提出日時 2020-08-23 16:26:52
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 433 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 82,640 KB
実行使用メモリ 210,688 KB
最終ジャッジ日時 2024-04-23 18:04:52
合計ジャッジ時間 4,819 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
57,728 KB
testcase_01 AC 36 ms
52,352 KB
testcase_02 AC 35 ms
52,096 KB
testcase_03 AC 499 ms
210,688 KB
testcase_04 AC 39 ms
52,480 KB
testcase_05 AC 366 ms
189,696 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
権限があれば一括ダウンロードができます

ソースコード

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