結果

問題 No.90 品物の並び替え
ユーザー c-yan
提出日時 2021-02-04 01:58:32
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 377 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 17,696 KB
最終ジャッジ日時 2024-06-30 09:01:23
合計ジャッジ時間 8,898 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

N, M = map(int, input().split())
scores = [tuple(map(int, input().split())) for _ in range(M)]

r = [0] * N
result = 0
for p in permutations(range(N)):
    for i in range(N):
        r[p[i]] = i
    t = 0
    for item1, item2, score in scores:
        if r[item1] < r[item2]:
            t += score
    result = max(result, t)
print(result)
0