結果

問題 No.90 品物の並び替え
ユーザー shokayamori
提出日時 2020-12-07 18:47:15
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 516 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 22,400 KB
最終ジャッジ日時 2024-09-17 14:00:34
合計ジャッジ時間 9,756 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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