結果

問題 No.1331 Moving Penguin
ユーザー yuruhiyayuruhiya
提出日時 2021-01-09 18:37:19
言語 Crystal
(1.11.2)
結果
WA  
実行時間 -
コード長 317 bytes
コンパイル時間 17,981 ms
コンパイル使用メモリ 255,712 KB
実行使用メモリ 14,204 KB
最終ジャッジ日時 2023-09-13 13:03:06
合計ジャッジ時間 38,871 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 4 ms
5,956 KB
testcase_02 AC 4 ms
5,912 KB
testcase_03 AC 4 ms
5,932 KB
testcase_04 AC 488 ms
12,528 KB
testcase_05 AC 484 ms
11,132 KB
testcase_06 AC 480 ms
11,164 KB
testcase_07 AC 484 ms
11,024 KB
testcase_08 AC 481 ms
10,536 KB
testcase_09 AC 482 ms
10,344 KB
testcase_10 AC 484 ms
10,332 KB
testcase_11 AC 485 ms
10,484 KB
testcase_12 AC 482 ms
10,420 KB
testcase_13 AC 482 ms
10,400 KB
testcase_14 AC 484 ms
10,508 KB
testcase_15 AC 483 ms
10,332 KB
testcase_16 AC 481 ms
10,356 KB
testcase_17 AC 481 ms
10,432 KB
testcase_18 AC 482 ms
10,492 KB
testcase_19 AC 483 ms
10,436 KB
testcase_20 AC 482 ms
10,332 KB
testcase_21 AC 482 ms
10,344 KB
testcase_22 AC 482 ms
10,400 KB
testcase_23 AC 484 ms
10,356 KB
testcase_24 AC 481 ms
10,356 KB
testcase_25 AC 482 ms
10,408 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 488 ms
14,204 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 485 ms
12,036 KB
testcase_36 AC 484 ms
12,048 KB
testcase_37 AC 484 ms
12,036 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 485 ms
11,844 KB
testcase_42 AC 486 ms
12,072 KB
testcase_43 AC 486 ms
12,028 KB
testcase_44 AC 483 ms
12,152 KB
testcase_45 AC 486 ms
11,972 KB
testcase_46 AC 485 ms
12,012 KB
testcase_47 AC 484 ms
11,932 KB
testcase_48 AC 482 ms
10,380 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
		j=i+a[i]
		while j<n
			dp[j]+=dp[i]%=M
			j+=a[i]
		end
	end
	dp[i+1]+=dp[i]%=M if i+1<n&&a[i]>1
}
p dp[n-1]
0