結果

問題 No.3046 yukicoderの過去問
ユーザー mlihua09mlihua09
提出日時 2020-08-23 17:00:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 517 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 76,540 KB
最終ジャッジ日時 2024-04-23 18:07:39
合計ジャッジ時間 8,995 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 540 ms
49,192 KB
testcase_01 AC 532 ms
43,812 KB
testcase_02 AC 535 ms
43,812 KB
testcase_03 AC 1,356 ms
71,456 KB
testcase_04 AC 539 ms
44,196 KB
testcase_05 AC 775 ms
70,948 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

K = int(input())

N = int(input())

import numpy as np


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

import sys

sys.setrecursionlimit(10 ** 9)

P = 10 ** 9 + 7

note = np.full(K + 1, -1)
note[0] = 1

def main(x):
    if x < 0:
        
        return 0
    
    if note[x] != -1:
        
        return note[x]
    
    note[x] = 0
    
    for i in X:
        
        if i > x:
            break
        
        note[x] += main(x - i)
        
        note[x] %= P
    
    return note[x]
    
print(main(K))
0