結果

問題 No.90 品物の並び替え
ユーザー tnoda_tnoda_
提出日時 2015-08-07 20:42:53
言語 Python2
(2.7.18)
結果
AC  
実行時間 3,441 ms / 5,000 ms
コード長 389 bytes
コンパイル時間 1,236 ms
コンパイル使用メモリ 6,672 KB
実行使用メモリ 6,160 KB
最終ジャッジ日時 2023-09-25 05:54:51
合計ジャッジ時間 5,518 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,940 KB
testcase_01 AC 251 ms
6,024 KB
testcase_02 AC 11 ms
5,936 KB
testcase_03 AC 26 ms
5,940 KB
testcase_04 AC 37 ms
6,120 KB
testcase_05 AC 288 ms
6,112 KB
testcase_06 AC 200 ms
6,120 KB
testcase_07 AC 14 ms
6,080 KB
testcase_08 AC 11 ms
6,020 KB
testcase_09 AC 3,441 ms
6,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

N, M = map(int, raw_input().strip().split())
i1 = [0] * M
i2 = [0] * M
score = [0] * M
for i in range(M):
    i1[i], i2[i], score[i] = map(int, raw_input().strip().split())


def total(r):
    res = 0
    for i in range(M):
        if r[i1[i]] < r[i2[i]]:
            res += score[i]
    return res

print(max(total(r) for r in permutations(range(N))))
0