結果

問題 No.30 たこやき工場
ユーザー yaoshimaxyaoshimax
提出日時 2015-02-15 01:46:00
言語 Python2
(2.7.18)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 493 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 6,608 KB
実行使用メモリ 6,112 KB
最終ジャッジ日時 2023-09-06 01:12:10
合計ジャッジ時間 1,315 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,108 KB
testcase_01 AC 11 ms
5,900 KB
testcase_02 AC 10 ms
5,988 KB
testcase_03 AC 11 ms
5,940 KB
testcase_04 AC 11 ms
5,952 KB
testcase_05 AC 11 ms
5,936 KB
testcase_06 AC 11 ms
5,876 KB
testcase_07 AC 11 ms
6,064 KB
testcase_08 AC 11 ms
5,896 KB
testcase_09 AC 11 ms
5,944 KB
testcase_10 AC 15 ms
6,088 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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