結果
| 問題 | No.30 たこやき工場 | 
| コンテスト | |
| ユーザー |  rlangevin | 
| 提出日時 | 2023-09-12 08:53:53 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                MLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 419 bytes | 
| コンパイル時間 | 1,288 ms | 
| コンパイル使用メモリ | 81,408 KB | 
| 実行使用メモリ | 840,968 KB | 
| 最終ジャッジ日時 | 2024-06-29 21:37:57 | 
| 合計ジャッジ時間 | 5,357 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 MLE * 1 -- * 6 | 
ソースコード
from collections import *
N = int(input())
M = int(input())
G = [[] for i in range(N)]
for i in range(M):
    p, q, r = map(int, input().split())
    p, r = p - 1, r - 1
    G[r].append((p, q))
Q = deque([N - 1])
ans = [0] * N
ans[-1] = 1
while Q:
    u = Q.popleft()
    for v, c in G[u]:
        ans[v] += ans[u] * c
        Q.append(v)
    if len(G[u]):
        ans[u] = 0
for i in range(N - 1):
    print(ans[i])
            
            
            
        