結果
| 問題 |
No.3018 目隠し宝探し
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 21:00:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 846 bytes |
| コンパイル時間 | 171 ms |
| コンパイル使用メモリ | 82,096 KB |
| 実行使用メモリ | 83,884 KB |
| 平均クエリ数 | 1.00 |
| 最終ジャッジ日時 | 2025-04-15 21:05:19 |
| 合計ジャッジ時間 | 4,367 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 1 |
| other | RE * 21 |
ソースコード
n = int(input())
m = int(input())
# Initialize data structures to hold links and their sums
links = [[] for _ in range(n)]
sum_c = [0] * n
for _ in range(m):
a, b, c = map(int, input().split())
links[a].append((b, c))
sum_c[a] += c
# Precompute the ratio for each link
out_links = [[] for _ in range(n)]
for a in range(n):
total = sum_c[a]
for (b, c) in links[a]:
ratio = c / total
out_links[a].append((b, ratio))
# Initialize current people
current = [10.0] * n
# Simulate 100 iterations
for _ in range(100):
next_people = [0.0] * n
for a in range(n):
people = current[a]
for (b, ratio) in out_links[a]:
next_people[b] += people * ratio
current = next_people
# Print the results formatted to six decimal places
for val in current:
print("{0:.6f}".format(val))
lam6er