結果

問題 No.90 品物の並び替え
ユーザー halshiphalship
提出日時 2021-06-04 21:27:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 370 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 16,128 KB
最終ジャッジ日時 2024-04-30 01:38:10
合計ジャッジ時間 8,649 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 506 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 58 ms
10,624 KB
testcase_04 AC 78 ms
10,880 KB
testcase_05 AC 599 ms
10,752 KB
testcase_06 AC 390 ms
10,624 KB
testcase_07 AC 36 ms
10,752 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

n, m = [int(s) for s in input().split()]
table = []

for i in range(m):
    table.append([int(s) for s in input().split()])


max_score = 0
for perm in permutations(range(n), n):
    score = 0
    for i1, i2, sc in table:
        if perm[i1] < perm[i2]:
            score += sc
    max_score = max(max_score, score)

print(max_score)
0