結果

問題 No.695 square1001 and Permutation 4
ユーザー gew1fw
提出日時 2025-06-12 21:34:10
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 500 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,960 KB
実行使用メモリ 231,244 KB
最終ジャッジ日時 2025-06-12 21:35:00
合計ジャッジ時間 10,867 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 MLE * 1
other MLE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.read().split()
    MOD = 100000000000000007
    
    n = int(input[0])
    m = int(input[1])
    x = list(map(int, input[2:2+m]))
    
    if n == 1:
        print(1)
        return
    
    a = [0] * (n + 1)
    a[1] = 1
    
    for i in range(2, n + 1):
        total = 0
        for xj in x:
            if i - xj >= 1:
                total += a[i - xj]
        a[i] = total % MOD
    
    print(a[n] % MOD)

if __name__ == "__main__":
    main()
0