結果
問題 | No.30 たこやき工場 |
ユーザー | yuki2006 |
提出日時 | 2014-09-25 22:49:10 |
言語 | Python2 (2.7.18) |
結果 |
TLE
|
実行時間 | - |
コード長 | 574 bytes |
コンパイル時間 | 103 ms |
コンパイル使用メモリ | 6,724 KB |
実行使用メモリ | 11,100 KB |
最終ジャッジ日時 | 2023-08-28 18:31:16 |
合計ジャッジ時間 | 8,691 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 13 ms
6,668 KB |
testcase_01 | AC | 13 ms
6,520 KB |
testcase_02 | AC | 13 ms
6,608 KB |
testcase_03 | AC | 13 ms
6,704 KB |
testcase_04 | AC | 13 ms
6,516 KB |
testcase_05 | AC | 13 ms
6,508 KB |
testcase_06 | AC | 14 ms
6,664 KB |
testcase_07 | AC | 14 ms
6,616 KB |
testcase_08 | AC | 1,694 ms
6,656 KB |
testcase_09 | AC | 18 ms
6,744 KB |
testcase_10 | TLE | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
ソースコード
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]