結果

問題 No.1331 Moving Penguin
ユーザー yuruhiyayuruhiya
提出日時 2021-01-09 18:41:05
言語 Crystal
(1.11.2)
結果
WA  
実行時間 -
コード長 309 bytes
コンパイル時間 18,744 ms
コンパイル使用メモリ 255,932 KB
実行使用メモリ 12,712 KB
最終ジャッジ日時 2023-09-13 13:02:15
合計ジャッジ時間 41,782 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 4 ms
5,904 KB
testcase_02 AC 4 ms
6,004 KB
testcase_03 AC 4 ms
5,824 KB
testcase_04 AC 506 ms
12,712 KB
testcase_05 AC 504 ms
11,188 KB
testcase_06 AC 503 ms
11,096 KB
testcase_07 AC 504 ms
11,208 KB
testcase_08 AC 492 ms
10,444 KB
testcase_09 AC 492 ms
10,388 KB
testcase_10 AC 492 ms
10,436 KB
testcase_11 AC 499 ms
10,256 KB
testcase_12 AC 494 ms
10,324 KB
testcase_13 AC 496 ms
10,504 KB
testcase_14 AC 499 ms
10,436 KB
testcase_15 AC 503 ms
10,336 KB
testcase_16 AC 501 ms
10,336 KB
testcase_17 AC 503 ms
10,372 KB
testcase_18 AC 503 ms
10,352 KB
testcase_19 AC 511 ms
10,436 KB
testcase_20 AC 489 ms
10,268 KB
testcase_21 AC 486 ms
10,264 KB
testcase_22 AC 485 ms
10,260 KB
testcase_23 AC 498 ms
10,356 KB
testcase_24 AC 498 ms
10,388 KB
testcase_25 AC 501 ms
10,348 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 503 ms
12,564 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 505 ms
12,052 KB
testcase_36 AC 503 ms
12,012 KB
testcase_37 AC 505 ms
12,028 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 507 ms
11,812 KB
testcase_42 AC 501 ms
12,036 KB
testcase_43 AC 505 ms
12,112 KB
testcase_44 AC 503 ms
11,996 KB
testcase_45 AC 504 ms
11,988 KB
testcase_46 AC 506 ms
12,100 KB
testcase_47 AC 506 ms
12,156 KB
testcase_48 AC 480 ms
10,368 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]
0