結果

問題 No.90 品物の並び替え
ユーザー halship
提出日時 2021-06-04 21:27:37
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 370 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 17,700 KB
最終ジャッジ日時 2024-11-19 12:25:22
合計ジャッジ時間 8,476 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

n, m = [int(s) for s in input().split()]
table = []

for i in range(m):
    table.append([int(s) for s in input().split()])


max_score = 0
for perm in permutations(range(n), n):
    score = 0
    for i1, i2, sc in table:
        if perm[i1] < perm[i2]:
            score += sc
    max_score = max(max_score, score)

print(max_score)
0