結果

問題 No.1331 Moving Penguin
ユーザー yuruhiyayuruhiya
提出日時 2021-01-09 18:33:15
言語 Crystal
(1.11.2)
結果
RE  
実行時間 -
コード長 348 bytes
コンパイル時間 18,189 ms
コンパイル使用メモリ 255,460 KB
実行使用メモリ 14,704 KB
最終ジャッジ日時 2023-09-13 13:01:29
合計ジャッジ時間 35,622 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 4 ms
5,944 KB
testcase_02 AC 4 ms
5,996 KB
testcase_03 AC 4 ms
6,028 KB
testcase_04 RE -
testcase_05 AC 489 ms
11,096 KB
testcase_06 AC 487 ms
11,140 KB
testcase_07 AC 488 ms
11,216 KB
testcase_08 AC 485 ms
10,412 KB
testcase_09 AC 484 ms
10,348 KB
testcase_10 AC 485 ms
10,424 KB
testcase_11 AC 488 ms
10,480 KB
testcase_12 AC 486 ms
10,380 KB
testcase_13 AC 489 ms
10,416 KB
testcase_14 AC 488 ms
10,464 KB
testcase_15 AC 486 ms
10,444 KB
testcase_16 AC 486 ms
10,380 KB
testcase_17 AC 488 ms
10,476 KB
testcase_18 AC 488 ms
10,268 KB
testcase_19 AC 488 ms
10,372 KB
testcase_20 AC 484 ms
10,312 KB
testcase_21 AC 486 ms
10,416 KB
testcase_22 AC 484 ms
10,372 KB
testcase_23 AC 490 ms
10,340 KB
testcase_24 AC 489 ms
10,304 KB
testcase_25 AC 484 ms
10,360 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 491 ms
12,040 KB
testcase_36 AC 489 ms
11,956 KB
testcase_37 AC 490 ms
11,940 KB
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 AC 487 ms
11,848 KB
testcase_42 AC 491 ms
12,016 KB
testcase_43 AC 490 ms
11,968 KB
testcase_44 AC 489 ms
12,016 KB
testcase_45 AC 495 ms
12,044 KB
testcase_46 AC 487 ms
12,024 KB
testcase_47 AC 485 ms
12,112 KB
testcase_48 AC 486 ms
10,428 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]=(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