結果

問題 No.90 品物の並び替え
ユーザー はむ吉🐹
提出日時 2016-02-14 17:36:15
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 521 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,036 KB
実行使用メモリ 104,080 KB
最終ジャッジ日時 2024-09-22 06:31:33
合計ジャッジ時間 9,164 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/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])
0