結果
| 問題 |
No.30 たこやき工場
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-09-25 22:48:21 |
| 言語 | Python2 (2.7.18) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 574 bytes |
| コンパイル時間 | 398 ms |
| コンパイル使用メモリ | 7,072 KB |
| 実行使用メモリ | 13,952 KB |
| 最終ジャッジ日時 | 2024-12-30 03:11:37 |
| 合計ジャッジ時間 | 9,847 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / 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]