結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,144 KB
testcase_01 AC 912 ms
11,820 KB
testcase_02 AC 28 ms
10,144 KB
testcase_03 AC 76 ms
10,340 KB
testcase_04 AC 112 ms
10,344 KB
testcase_05 AC 1,059 ms
11,820 KB
testcase_06 AC 713 ms
11,820 KB
testcase_07 AC 36 ms
10,164 KB
testcase_08 AC 28 ms
10,144 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:
        for elem in perm:
            if elem == forth:
                break
            elif  elem == back:
                total_score += score
                break
            else:
                continue
    total_score_list.append(total_score)

print(max(total_score_list))
0