結果

問題 No.90 品物の並び替え
ユーザー kutsutamakutsutama
提出日時 2018-12-24 02:21:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 4,328 ms / 5,000 ms
コード長 413 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 11,840 KB
実行使用メモリ 10,012 KB
最終ジャッジ日時 2023-10-26 02:55:21
合計ジャッジ時間 6,934 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,012 KB
testcase_01 AC 425 ms
10,012 KB
testcase_02 AC 28 ms
10,012 KB
testcase_03 AC 68 ms
10,012 KB
testcase_04 AC 70 ms
10,012 KB
testcase_05 AC 426 ms
10,012 KB
testcase_06 AC 448 ms
10,012 KB
testcase_07 AC 34 ms
10,012 KB
testcase_08 AC 29 ms
10,012 KB
testcase_09 AC 4,328 ms
10,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

n, m = [int(x) for x in input().split()]
table = []
for i in range(n):
    table += [[0] * n]
for i in range(m):
    it1, it2, sc = [int(x) for x in input().split()]
    table[it1][it2] = sc

res = 0
for v in itertools.permutations(range(n)):
    score = 0
    for i in range(1, len(v)):
        for j in range(0, i):
            score += table[v[j]][v[i]]
    res = max(score, res)

print(res)
0