結果

問題 No.90 品物の並び替え
ユーザー shokayamori
提出日時 2020-12-07 18:48:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 516 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 105,292 KB
最終ジャッジ日時 2024-09-17 14:00:42
合計ジャッジ時間 8,450 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N, M = map(int, input().split())
score_table = []
for i in range(M):
    score_table.append(list(map(int, input().split())))

perms = itertools.permutations(list(range(N)))

total_score_list = []
for perm in perms:
    total_score = 0
    for [back, forth, score] in score_table:
        index_back = perm.index(back)
        index_forth = perm.index(forth)
        if index_back < index_forth:
            total_score += score
    total_score_list.append(total_score)

print(max(total_score_list))
0