結果
問題 | No.298 話の伝達 |
ユーザー |
![]() |
提出日時 | 2015-11-06 23:05:33 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 604 bytes |
コンパイル時間 | 1,620 ms |
コンパイル使用メモリ | 170,064 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-13 13:31:11 |
合計ジャッジ時間 | 2,154 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 11 |
ソースコード
#include "bits/stdc++.h"using namespace std;#define REP(i, n) for(int i=0; i<(n); i++)struct P { int x, y; P(){}; P(int _x, int _y): x(_x), y(_y){}; };int N,M,A,B,C;map<int, vector<P> > MAP;double dfs(int n) {if (n == 0) return 1.0;double fail = 1.0;for (auto&& p: MAP[n]) {fail *= 1.0 - dfs(p.x) * p.y / 100.0;}return 1 - fail;}signed main(){cin >> N >> M;vector<double> Q(N, 0.0);Q[0] = 1.0;REP(i,M) {cin >> A >> B >> C;P p = P(A, C);MAP[B].push_back(p);}printf("%.14f\n", dfs(N-1));return 0;}