結果
問題 |
No.30 たこやき工場
|
ユーザー |
|
提出日時 | 2014-09-25 22:49:10 |
言語 | Python2 (2.7.18) |
結果 |
TLE
|
実行時間 | - |
コード長 | 574 bytes |
コンパイル時間 | 203 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 13,824 KB |
最終ジャッジ日時 | 2024-12-30 03:13:09 |
合計ジャッジ時間 | 9,360 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 TLE * 1 |
ソースコード
import Queue n = int(raw_input()) m = int(raw_input()) INF = -1 table = [[INF for _ in xrange(n + 1)] for _ in xrange(n + 1)] for _ in xrange(m): p, q, r = map(int, raw_input().split()) table[p][r] = q buy = [0] * (n + 1) queue = Queue.deque() queue.append((n, 1)) while len(queue) > 0: current, cost = queue.pop() hit = False for i in xrange(n + 1): if table[i][current] != INF: queue.append((i, table[i][current] * cost)) hit = True if not hit: buy[current] += cost for i in xrange(1, n): print buy[i]