結果
問題 | No.298 話の伝達 |
ユーザー |
![]() |
提出日時 | 2015-11-06 22:48:51 |
言語 | D (dmd 2.109.1) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 867 bytes |
コンパイル時間 | 2,516 ms |
コンパイル使用メモリ | 159,872 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-12 02:44:48 |
合計ジャッジ時間 | 3,419 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 11 |
ソースコード
import std.stdio, std.conv;import std.algorithm, std.range, std.random;import std.string, std.array, std.container, std.bigint;import std.typecons;int main() {int n, m;readf("%d %d\n", &n, &m);alias E = Tuple!(int, int, double);E[] g;foreach (i; 0..m) {int a, b; double c;readf("%d %d %f\n", &a, &b, &c);g ~= tuple(a, b, c);}double[] res = new double[](n);bool[] used = new bool[](n);res[0] = 1; used[0] = true;foreach (_ ; 0..2*n) {foreach (i; 0..n) {if (used[i]) continue;bool f = true;double sm = 1;foreach (e; g) {if (e[1] != i) continue;if (used[e[0]] == false) {f = false;break;}sm *= (1 - res[e[0]]*e[2] / 100.0);}if (!f) continue;res[i] = 1-sm;used[i] = true;}}if (used[n-1]) {writef("%.20f\n", res[n-1]);} else {writeln(0);}return 0;}