結果

問題 No.3018 目隠し宝探し
ユーザー lam6er
提出日時 2025-03-31 17:23:46
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 648 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 84,728 KB
平均クエリ数 1.00
最終ジャッジ日時 2025-03-31 17:24:18
合計ジャッジ時間 4,706 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
m = int(input())

outgoing = [[] for _ in range(n)]
sum_weights = [0] * n

for _ in range(m):
    a, b, c = map(int, input().split())
    outgoing[a].append((b, c))
    sum_weights[a] += c

current_people = [10.0] * n

for _ in range(100):
    next_people = [0.0] * n
    for a in range(n):
        people = current_people[a]
        if people == 0.0:
            continue
        total_weight = sum_weights[a]
        for (b, c) in outgoing[a]:
            contribution = people * c / total_weight
            next_people[b] += contribution
    current_people = next_people

for u in current_people:
    print("{0:.6f}".format(u))
0