結果

問題 No.695 square1001 and Permutation 4
ユーザー simamumu
提出日時 2018-06-29 20:23:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
MLE  
実行時間 -
コード長 299 bytes
コンパイル時間 554 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 151,808 KB
最終ジャッジ日時 2024-07-22 19:34:59
合計ジャッジ時間 20,033 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 2 MLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())

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

x.sort()

dp = [0 for i in range(n)]

p = 100000000000000007 

for i in range(m):
	dp[x[i]] += 1
	
for i in range(n):
	for j in range(m):
		if i - x[j] >= 0:
			dp[i] += dp[i-x[j]]
			if dp[i] > p:
				dp[i] %= p
			
print(dp[n-1])
0