結果

問題 No.1331 Moving Penguin
ユーザー yuruhiyayuruhiya
提出日時 2021-01-09 18:41:53
言語 Crystal
(1.11.2)
結果
AC  
実行時間 450 ms / 1,500 ms
コード長 311 bytes
コンパイル時間 12,321 ms
コンパイル使用メモリ 296,548 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-25 05:09:01
合計ジャッジ時間 29,767 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 448 ms
10,240 KB
testcase_05 AC 437 ms
8,832 KB
testcase_06 AC 439 ms
9,216 KB
testcase_07 AC 433 ms
8,832 KB
testcase_08 AC 427 ms
8,704 KB
testcase_09 AC 438 ms
8,704 KB
testcase_10 AC 437 ms
8,704 KB
testcase_11 AC 431 ms
8,832 KB
testcase_12 AC 438 ms
8,704 KB
testcase_13 AC 438 ms
8,704 KB
testcase_14 AC 438 ms
8,704 KB
testcase_15 AC 442 ms
8,704 KB
testcase_16 AC 445 ms
8,704 KB
testcase_17 AC 435 ms
8,704 KB
testcase_18 AC 433 ms
8,832 KB
testcase_19 AC 434 ms
8,704 KB
testcase_20 AC 430 ms
8,704 KB
testcase_21 AC 433 ms
8,704 KB
testcase_22 AC 436 ms
8,704 KB
testcase_23 AC 431 ms
8,704 KB
testcase_24 AC 435 ms
8,704 KB
testcase_25 AC 438 ms
8,832 KB
testcase_26 AC 440 ms
10,240 KB
testcase_27 AC 435 ms
10,240 KB
testcase_28 AC 450 ms
10,240 KB
testcase_29 AC 429 ms
10,368 KB
testcase_30 AC 151 ms
6,272 KB
testcase_31 AC 247 ms
7,552 KB
testcase_32 AC 129 ms
6,016 KB
testcase_33 AC 194 ms
6,784 KB
testcase_34 AC 313 ms
8,704 KB
testcase_35 AC 437 ms
10,496 KB
testcase_36 AC 428 ms
10,496 KB
testcase_37 AC 436 ms
10,496 KB
testcase_38 AC 152 ms
6,272 KB
testcase_39 AC 421 ms
9,856 KB
testcase_40 AC 219 ms
7,040 KB
testcase_41 AC 434 ms
10,240 KB
testcase_42 AC 438 ms
10,496 KB
testcase_43 AC 435 ms
10,496 KB
testcase_44 AC 430 ms
10,496 KB
testcase_45 AC 436 ms
10,496 KB
testcase_46 AC 436 ms
10,496 KB
testcase_47 AC 434 ms
10,624 KB
testcase_48 AC 441 ms
8,704 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|[0i64]*i}
dp=[0i64]*n
dp[0]=1
n.times{|i|
	(1...m).each{|x|dp[i]+=b[x][i% x]%=M}
	if a[i]<m
		b[a[i]][i%a[i]]+=dp[i]%=M
	else
		(i+a[i]).step(to:n-1,by:a[i]){|j|dp[j]+=dp[i]%=M}
	end
	dp[i+1]+=dp[i]%=M if i+1<n&&a[i]>1
}
p dp[-1]%M
0