結果
問題 | No.30 たこやき工場 |
ユーザー |
![]() |
提出日時 | 2021-11-16 08:09:20 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 443 bytes |
コンパイル時間 | 129 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-12-15 23:03:25 |
合計ジャッジ時間 | 1,532 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 17 |
ソースコード
N=int(input())M=int(input())E=[[] for i in range(N+1)]OUT=[0]*(N+1)for i in range(M):p,q,r=map(int,input().split())E[r].append((p,q))OUT[p]+=1Q=[]for i in range(N+1):if OUT[i]==0:Q.append(i)ANS=[0]*(N+1)ANS[-1]=1while Q:x=Q.pop()for to,q in E[x]:OUT[to]-=1if OUT[to]==0:Q.append(to)ANS[to]+=ANS[x]*qif E[x]!=[]:ANS[x]=0print(*ANS[1:])