結果

問題 No.90 品物の並び替え
ユーザー shokayamorishokayamori
提出日時 2020-12-07 18:47:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 516 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 11,928 KB
実行使用メモリ 21,368 KB
最終ジャッジ日時 2023-10-17 16:36:39
合計ジャッジ時間 9,740 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,136 KB
testcase_01 AC 866 ms
11,808 KB
testcase_02 AC 29 ms
10,136 KB
testcase_03 AC 76 ms
10,332 KB
testcase_04 AC 112 ms
10,336 KB
testcase_05 AC 997 ms
11,808 KB
testcase_06 AC 691 ms
11,808 KB
testcase_07 AC 37 ms
10,156 KB
testcase_08 AC 28 ms
10,136 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