結果

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

ソースコード

diff #

n = int(input())
m = int(input())
trans = [[] for _ in range(n)]
sum_c = [0.0 for _ in range(n)]

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

users = [10.0 for _ in range(n)]

for _ in range(100):
    next_users = [0.0 for _ in range(n)]
    for i in range(n):
        current = users[i]
        if current == 0.0:
            continue
        edges = trans[i]
        total = sum_c[i]
        for (b, c) in edges:
            portion = (current * c) / total
            next_users[b] += portion
    users = next_users

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