結果
問題 | No.90 品物の並び替え |
ユーザー | はむ吉🐹 |
提出日時 | 2016-02-14 17:36:15 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 521 bytes |
コンパイル時間 | 156 ms |
コンパイル使用メモリ | 81,784 KB |
実行使用メモリ | 99,004 KB |
最終ジャッジ日時 | 2023-10-22 05:15:40 |
合計ジャッジ時間 | 9,730 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
53,584 KB |
testcase_01 | AC | 690 ms
79,004 KB |
testcase_02 | AC | 40 ms
53,592 KB |
testcase_03 | AC | 155 ms
77,432 KB |
testcase_04 | AC | 188 ms
76,944 KB |
testcase_05 | AC | 779 ms
78,992 KB |
testcase_06 | AC | 593 ms
79,448 KB |
testcase_07 | AC | 68 ms
70,432 KB |
testcase_08 | AC | 40 ms
53,592 KB |
testcase_09 | TLE | - |
ソースコード
#!/usr/bin/env pypy # -*- coding: utf-8 -*- import heapq import itertools if __name__ == "__main__": n, m = map(int, input().split()) table = {(item1, item2, score) for item1, item2, score in ( map(int, input().split()) for i in range(m))} sums = [] for items_p in itertools.permutations(range(n)): heapq.heappush(sums, -sum(score for (item1, item2, score) in table if items_p.index(item1) < items_p.index(item2))) print(-sums[0])