結果
| 問題 |
No.30 たこやき工場
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-09-12 08:54:49 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 419 bytes |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 14,008 KB |
| 最終ジャッジ日時 | 2024-06-29 21:39:10 |
| 合計ジャッジ時間 | 7,743 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 TLE * 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])
rlangevin