結果

問題 No.30 たこやき工場
ユーザー rlangevinrlangevin
提出日時 2023-09-12 08:53:53
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 419 bytes
コンパイル時間 1,591 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 831,100 KB
最終ジャッジ日時 2023-09-12 08:54:04
合計ジャッジ時間 6,594 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,508 KB
testcase_01 AC 95 ms
71,488 KB
testcase_02 AC 94 ms
71,312 KB
testcase_03 AC 94 ms
71,548 KB
testcase_04 AC 94 ms
71,312 KB
testcase_05 AC 94 ms
71,448 KB
testcase_06 AC 94 ms
71,436 KB
testcase_07 AC 94 ms
71,580 KB
testcase_08 AC 139 ms
82,072 KB
testcase_09 AC 100 ms
72,348 KB
testcase_10 MLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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])
0