結果
| 問題 | No.30 たこやき工場 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-12-31 11:56:27 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 476 bytes |
| 記録 | |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 82,020 KB |
| 実行使用メモリ | 71,236 KB |
| 最終ジャッジ日時 | 2024-10-08 04:49:32 |
| 合計ジャッジ時間 | 1,927 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 6 |
ソースコード
from collections import deque
n = int(input())
m = int(input())
e = [[] for i in range(n)]
par = [0]*n
for i in range(m):
p,q,r = map(int,input().split())
e[r-1].append([p-1,q])
par[p-1] += 1
q = deque([-1])
ans = [0]*n
ans[-1] = 1
while q:
now = q.popleft()
for nex,a in e[now]:
ans[nex] += ans[now]*a
par[nex] -= 1
if par[nex] == 0:
q.append(nex)
if e[now]:
ans[now] = 0
for i in ans[:-1]:
print(i)