結果

問題 No.660 家を通り過ぎないランダムウォーク問題
ユーザー cielciel
提出日時 2018-03-05 00:59:52
言語 Ruby
(3.3.0)
結果
AC  
実行時間 499 ms / 2,000 ms
コード長 249 bytes
コンパイル時間 36 ms
コンパイル使用メモリ 11,528 KB
実行使用メモリ 29,372 KB
最終ジャッジ日時 2023-09-25 01:44:13
合計ジャッジ時間 8,062 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,180 KB
testcase_01 AC 85 ms
15,052 KB
testcase_02 AC 80 ms
15,204 KB
testcase_03 AC 80 ms
15,164 KB
testcase_04 AC 80 ms
15,100 KB
testcase_05 AC 82 ms
15,112 KB
testcase_06 AC 81 ms
15,032 KB
testcase_07 AC 81 ms
15,160 KB
testcase_08 AC 80 ms
15,096 KB
testcase_09 AC 82 ms
15,208 KB
testcase_10 AC 81 ms
15,252 KB
testcase_11 AC 82 ms
15,096 KB
testcase_12 AC 81 ms
15,104 KB
testcase_13 AC 81 ms
15,208 KB
testcase_14 AC 82 ms
15,252 KB
testcase_15 AC 82 ms
15,204 KB
testcase_16 AC 81 ms
14,984 KB
testcase_17 AC 81 ms
15,208 KB
testcase_18 AC 79 ms
15,028 KB
testcase_19 AC 79 ms
15,104 KB
testcase_20 AC 79 ms
15,128 KB
testcase_21 AC 80 ms
15,032 KB
testcase_22 AC 82 ms
15,080 KB
testcase_23 AC 81 ms
15,208 KB
testcase_24 AC 82 ms
15,028 KB
testcase_25 AC 84 ms
15,044 KB
testcase_26 AC 85 ms
15,228 KB
testcase_27 AC 85 ms
15,028 KB
testcase_28 AC 84 ms
15,308 KB
testcase_29 AC 91 ms
15,708 KB
testcase_30 AC 94 ms
15,792 KB
testcase_31 AC 96 ms
15,620 KB
testcase_32 AC 100 ms
16,004 KB
testcase_33 AC 102 ms
16,224 KB
testcase_34 AC 103 ms
16,336 KB
testcase_35 AC 146 ms
17,712 KB
testcase_36 AC 149 ms
17,944 KB
testcase_37 AC 153 ms
18,100 KB
testcase_38 AC 260 ms
21,228 KB
testcase_39 AC 272 ms
21,756 KB
testcase_40 AC 277 ms
22,048 KB
testcase_41 AC 406 ms
26,280 KB
testcase_42 AC 407 ms
26,232 KB
testcase_43 AC 461 ms
28,228 KB
testcase_44 AC 499 ms
29,372 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N=gets.to_i
M=10**9+7;I=[1,1];*F=I;*R=I
2.upto(N*3){|i|I<<z=(M-M/i)*I[M%i]%M;F<<i*F[-1]%M;R<<z*R[-1]%M}

r=c=0
(0..N/2).each{|k|r=(r+F[N+2*k]*R[N+k]*R[k])%M}
(N/2-1).downto(0){|j|k=N/2-j;r=(r-2*F[N+2*j]*R[N+j]*R[j]*c=c+F[2*k-2]*R[k]*R[k-1]%M)%M}
p r
0