結果

問題 No.90 品物の並び替え
ユーザー c-yanc-yan
提出日時 2021-02-04 01:58:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 377 bytes
コンパイル時間 806 ms
コンパイル使用メモリ 10,932 KB
実行使用メモリ 13,192 KB
最終ジャッジ日時 2023-09-12 21:30:26
合計ジャッジ時間 8,824 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
13,120 KB
testcase_01 AC 478 ms
8,080 KB
testcase_02 AC 16 ms
8,172 KB
testcase_03 AC 46 ms
8,060 KB
testcase_04 AC 63 ms
8,176 KB
testcase_05 AC 532 ms
8,220 KB
testcase_06 AC 378 ms
8,148 KB
testcase_07 AC 21 ms
8,268 KB
testcase_08 AC 16 ms
8,104 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

N, M = map(int, input().split())
scores = [tuple(map(int, input().split())) for _ in range(M)]

r = [0] * N
result = 0
for p in permutations(range(N)):
    for i in range(N):
        r[p[i]] = i
    t = 0
    for item1, item2, score in scores:
        if r[item1] < r[item2]:
            t += score
    result = max(result, t)
print(result)
0