結果
問題 | No.298 話の伝達 |
ユーザー | Tsuneo Yoshioka |
提出日時 | 2015-11-07 00:05:21 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 484 bytes |
コンパイル時間 | 337 ms |
コンパイル使用メモリ | 11,512 KB |
実行使用メモリ | 15,392 KB |
最終ジャッジ日時 | 2023-10-11 14:34:34 |
合計ジャッジ時間 | 2,860 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 81 ms
15,328 KB |
testcase_02 | AC | 80 ms
15,120 KB |
testcase_03 | AC | 81 ms
15,252 KB |
testcase_04 | WA | - |
testcase_05 | AC | 82 ms
15,244 KB |
testcase_06 | WA | - |
testcase_07 | AC | 81 ms
15,256 KB |
testcase_08 | AC | 81 ms
15,312 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 80 ms
15,272 KB |
testcase_12 | AC | 79 ms
15,236 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 81 ms
15,084 KB |
testcase_16 | AC | 83 ms
15,040 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
コンパイルメッセージ
Syntax OK
ソースコード
N, M = gets.split.map(&:to_i) @graph=Array.new(N).map{Array.new()} @rgraph=Array.new(N).map{Array.new()} while gets a,b,c=$_.split.map(&:to_i) @graph[a].push([b,c/100.0]) @rgraph[b].push([a,c/100.0]) end @memo={} def go(n) if @memo[n] return @memo[n] end neg=1.00 @rgraph[n].each{|pa| i = pa[0] p = pa[1] neg *= (1-go(i)*p) } ret = 1.00 - neg @memo[n] = ret return ret end @memo[0]=1 ret = go(N-1) puts ret