結果

問題 No.90 品物の並び替え
ユーザー shokayamorishokayamori
提出日時 2020-12-07 18:48:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 516 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 99,500 KB
最終ジャッジ日時 2023-10-17 16:36:48
合計ジャッジ時間 8,828 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,616 KB
testcase_01 AC 601 ms
77,792 KB
testcase_02 AC 35 ms
53,616 KB
testcase_03 AC 72 ms
72,604 KB
testcase_04 AC 97 ms
75,504 KB
testcase_05 AC 641 ms
77,624 KB
testcase_06 AC 441 ms
77,136 KB
testcase_07 AC 48 ms
64,092 KB
testcase_08 AC 36 ms
53,616 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

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