結果
問題 | No.30 たこやき工場 |
ユーザー |
![]() |
提出日時 | 2015-02-15 01:46:00 |
言語 | Python2 (2.7.18) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 493 bytes |
コンパイル時間 | 52 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 6,528 KB |
最終ジャッジ日時 | 2024-06-23 20:18:11 |
合計ジャッジ時間 | 1,074 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 WA * 6 |
ソースコード
N=int(raw_input()) outdeg= [0 for i in range(N+1)] edges=[[] for i in range(N+1)] cnt = [0 for i in range(N+1)] M=int(raw_input()) for i in range(M): P,Q,R = map(int,raw_input().split()) edges[R].append((P,Q)) outdeg[P]+=1 cnt[N]=1 l=[N] while len(l)!=0: cur = l.pop() if len(edges[cur])!=0 : for p,q in edges[cur]: outdeg[p]-=1 cnt[p]+=cnt[cur]*q if outdeg[p]==0 : l.append(p) cnt[cur]=0 for i in range(1,N): print cnt[i]