結果

問題 No.1331 Moving Penguin
ユーザー yuruhiyayuruhiya
提出日時 2021-01-09 18:31:13
言語 Crystal
(1.11.2)
結果
RE  
実行時間 -
コード長 342 bytes
コンパイル時間 18,572 ms
コンパイル使用メモリ 254,408 KB
実行使用メモリ 12,016 KB
最終ジャッジ日時 2023-09-13 13:00:36
合計ジャッジ時間 35,929 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 3 ms
5,104 KB
testcase_02 AC 3 ms
5,120 KB
testcase_03 AC 4 ms
5,208 KB
testcase_04 RE -
testcase_05 AC 441 ms
10,548 KB
testcase_06 AC 440 ms
10,592 KB
testcase_07 AC 440 ms
10,560 KB
testcase_08 AC 441 ms
9,492 KB
testcase_09 AC 440 ms
9,516 KB
testcase_10 AC 440 ms
9,480 KB
testcase_11 AC 440 ms
9,516 KB
testcase_12 AC 440 ms
9,668 KB
testcase_13 AC 441 ms
9,584 KB
testcase_14 AC 440 ms
9,516 KB
testcase_15 AC 439 ms
9,532 KB
testcase_16 AC 440 ms
9,456 KB
testcase_17 AC 441 ms
9,592 KB
testcase_18 AC 442 ms
9,556 KB
testcase_19 AC 441 ms
9,428 KB
testcase_20 AC 442 ms
9,504 KB
testcase_21 AC 438 ms
9,588 KB
testcase_22 AC 441 ms
9,556 KB
testcase_23 AC 438 ms
10,256 KB
testcase_24 AC 438 ms
9,476 KB
testcase_25 AC 441 ms
9,516 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 442 ms
10,824 KB
testcase_36 AC 441 ms
10,828 KB
testcase_37 AC 443 ms
10,720 KB
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 AC 442 ms
10,816 KB
testcase_42 AC 442 ms
10,844 KB
testcase_43 AC 439 ms
10,736 KB
testcase_44 AC 443 ms
10,816 KB
testcase_45 AC 440 ms
10,860 KB
testcase_46 AC 439 ms
10,820 KB
testcase_47 AC 443 ms
10,808 KB
testcase_48 AC 441 ms
9,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M=10**9+7
m=512
n=read_line.to_i
a=read_line.split.map(&.to_i)
b=(0...m).map{|i|[0]*i}
dp=[0]*n
dp[0]=1
n.times{|i|
	(1...m).each{|x|dp[i]=(dp[i]+b[x][i% x])%M}
	if a[i]<m
		b[a[i]][i%a[i]]=(b[a[i]][i%a[i]]+dp[i])%M
	else
		j=i
		while j<n
			j+=a[i]
			dp[j]=(dp[j]+dp[i])%M
		end
	end
	dp[i+1]=(dp[i+1]+dp[i])%M if i+1<n&&a[i]>1
}
p dp[n-1]
0