結果

問題 No.298 話の伝達
ユーザー cielciel
提出日時 2015-11-09 21:14:09
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 340 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 11,424 KB
実行使用メモリ 22,740 KB
最終ジャッジ日時 2023-10-11 15:27:40
合計ジャッジ時間 23,555 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
19,684 KB
testcase_01 AC 83 ms
15,116 KB
testcase_02 AC 82 ms
15,140 KB
testcase_03 AC 83 ms
15,048 KB
testcase_04 AC 80 ms
15,316 KB
testcase_05 AC 3,362 ms
18,440 KB
testcase_06 AC 91 ms
15,212 KB
testcase_07 AC 81 ms
15,372 KB
testcase_08 AC 81 ms
15,124 KB
testcase_09 AC 90 ms
15,516 KB
testcase_10 AC 164 ms
16,644 KB
testcase_11 AC 3,872 ms
18,484 KB
testcase_12 AC 1,792 ms
17,848 KB
testcase_13 AC 4,237 ms
18,436 KB
testcase_14 AC 1,966 ms
17,604 KB
testcase_15 AC 84 ms
15,036 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby
N,M=gets.split.map(&:to_i)
G=Hash.new{|h,k|h[k]=[]}
$<.each{|e|
	a,b,c=e.split.map(&:to_i)
	G[b]<<[a,c/100.0]
}
(p 0;exit)if N==1	
r=0
(1<<(N-2)).times{|i|
	a=[0]+[1]*(N-1)
	N.times{|j|
		G[j].each{|x,y|a[j]*=1-y if x==0||x==N-1||i[x-1]==1}
	}
	r0=1
	N.times{|j|
		r0*=j==0||j==N-1||i[j-1]==1 ? 1-a[j] : a[j]
	}
	r+=r0
}
p r
0