結果
| 問題 |
No.3018 目隠し宝探し
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 21:30:27 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 913 bytes |
| コンパイル時間 | 249 ms |
| コンパイル使用メモリ | 81,612 KB |
| 実行使用メモリ | 83,828 KB |
| 平均クエリ数 | 1.00 |
| 最終ジャッジ日時 | 2025-06-12 21:31:10 |
| 合計ジャッジ時間 | 5,343 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 1 |
| other | RE * 21 |
ソースコード
import sys
from collections import defaultdict
def main():
n = int(sys.stdin.readline())
m = int(sys.stdin.readline())
trans = defaultdict(list)
sum_c = [0.0] * n
for _ in range(m):
a, b, c = map(int, sys.stdin.readline().split())
trans[a].append((b, c))
sum_c[a] += c # Accumulate sum as we read
current_state = [10.0 for _ in range(n)]
for _ in range(100):
next_state = [0.0] * n
for u in range(n):
pop = current_state[u]
if pop == 0:
continue
s = sum_c[u]
if s == 0:
continue # Shouldn't happen as per problem statement
for (v, c) in trans[u]:
next_state[v] += pop * c / s
current_state = next_state.copy()
for u in range(n):
print("{0:.6f}".format(current_state[u]))
if __name__ == "__main__":
main()
gew1fw