結果

問題 No.498 ワープクリスタル (給料日編)
ユーザー cielciel
提出日時 2017-04-24 00:30:19
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 375 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 11,228 KB
実行使用メモリ 15,900 KB
最終ジャッジ日時 2023-09-29 16:11:42
合計ジャッジ時間 8,228 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,144 KB
testcase_01 AC 79 ms
15,056 KB
testcase_02 AC 78 ms
15,064 KB
testcase_03 AC 78 ms
15,196 KB
testcase_04 AC 441 ms
15,760 KB
testcase_05 AC 79 ms
14,972 KB
testcase_06 AC 439 ms
15,900 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 442 ms
15,760 KB
testcase_10 AC 79 ms
15,112 KB
testcase_11 AC 130 ms
15,736 KB
testcase_12 AC 79 ms
15,100 KB
testcase_13 AC 94 ms
15,736 KB
testcase_14 AC 80 ms
15,056 KB
testcase_15 AC 82 ms
15,160 KB
testcase_16 AC 78 ms
15,252 KB
testcase_17 AC 82 ms
15,192 KB
testcase_18 AC 440 ms
15,800 KB
testcase_19 AC 441 ms
15,788 KB
testcase_20 AC 437 ms
15,760 KB
testcase_21 AC 443 ms
15,784 KB
testcase_22 AC 445 ms
15,768 KB
testcase_23 AC 442 ms
15,824 KB
testcase_24 AC 443 ms
15,800 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

M=10**9+7;I=[1,1];*F=I;*R=I
2.upto(99){|i|I<<z=(M-M/i)*I[M%i]%M;F<<i*F[-1]%M;R<<z*R[-1]%M}
def dfs(x,y,a)
	r=x!=W||y!=H||a[-1].to_i==0 ? 0 : F[a.reduce(0,:+)]*a.map{|e|R[e]}.reduce(1,:*)%M
	if a.size<A.size
		dx,dy,n=A[a.size]
		(0..n).each{|i|
			r=(r+dfs(x+dx*i,y+dy*i,a+[i]))%M
		}
	end
	r
end
W,H,K=gets.split.map &:to_i
A=K.times.map{gets.split.map &:to_i}
p dfs(0,0,[])
0