結果

問題 No.660 家を通り過ぎないランダムウォーク問題
ユーザー cielciel
提出日時 2018-03-05 01:10:48
言語 Ruby
(3.2.2)
結果
AC  
実行時間 483 ms / 2,000 ms
コード長 240 bytes
コンパイル時間 40 ms
コンパイル使用メモリ 11,548 KB
実行使用メモリ 29,644 KB
最終ジャッジ日時 2023-09-25 03:29:57
合計ジャッジ時間 7,754 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,132 KB
testcase_01 AC 80 ms
15,132 KB
testcase_02 AC 80 ms
15,272 KB
testcase_03 AC 80 ms
15,040 KB
testcase_04 AC 80 ms
15,148 KB
testcase_05 AC 79 ms
15,276 KB
testcase_06 AC 79 ms
15,120 KB
testcase_07 AC 79 ms
15,040 KB
testcase_08 AC 81 ms
15,028 KB
testcase_09 AC 79 ms
15,272 KB
testcase_10 AC 79 ms
15,228 KB
testcase_11 AC 79 ms
15,052 KB
testcase_12 AC 79 ms
15,044 KB
testcase_13 AC 80 ms
15,276 KB
testcase_14 AC 80 ms
15,272 KB
testcase_15 AC 80 ms
15,036 KB
testcase_16 AC 80 ms
15,128 KB
testcase_17 AC 81 ms
15,208 KB
testcase_18 AC 82 ms
15,088 KB
testcase_19 AC 79 ms
15,124 KB
testcase_20 AC 79 ms
15,120 KB
testcase_21 AC 80 ms
15,076 KB
testcase_22 AC 80 ms
15,188 KB
testcase_23 AC 84 ms
15,148 KB
testcase_24 AC 83 ms
15,172 KB
testcase_25 AC 83 ms
15,272 KB
testcase_26 AC 84 ms
15,264 KB
testcase_27 AC 84 ms
15,144 KB
testcase_28 AC 84 ms
15,336 KB
testcase_29 AC 90 ms
15,732 KB
testcase_30 AC 90 ms
15,680 KB
testcase_31 AC 91 ms
15,788 KB
testcase_32 AC 99 ms
16,196 KB
testcase_33 AC 99 ms
16,288 KB
testcase_34 AC 101 ms
16,448 KB
testcase_35 AC 144 ms
18,080 KB
testcase_36 AC 144 ms
18,260 KB
testcase_37 AC 146 ms
18,076 KB
testcase_38 AC 249 ms
21,268 KB
testcase_39 AC 260 ms
21,664 KB
testcase_40 AC 263 ms
21,804 KB
testcase_41 AC 391 ms
26,312 KB
testcase_42 AC 389 ms
26,188 KB
testcase_43 AC 447 ms
28,032 KB
testcase_44 AC 483 ms
29,644 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}
C=->n,a,b,c,f=1{(n+F[a]*R[b]*R[c]*f)%M}
r=C[c=0,N+2*Z=N/2,N+Z,Z]
(Z-1).downto(0){|j|k=Z-j;r=C[r,N+2*j,N+j,j,1-2*c=C[c,2*k-2,k,k-1]]}
p r
0