結果

問題 No.90 品物の並び替え
ユーザー kutsutamakutsutama
提出日時 2018-12-24 01:59:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 440 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 11,900 KB
実行使用メモリ 14,376 KB
最終ジャッジ日時 2023-10-26 02:53:49
合計ジャッジ時間 10,463 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,044 KB
testcase_01 AC 1,088 ms
10,044 KB
testcase_02 AC 27 ms
10,044 KB
testcase_03 AC 85 ms
10,044 KB
testcase_04 AC 131 ms
10,044 KB
testcase_05 AC 1,280 ms
10,044 KB
testcase_06 AC 858 ms
10,044 KB
testcase_07 AC 38 ms
10,044 KB
testcase_08 AC 27 ms
10,044 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

n, m = [int(x) for x in input().split()]
tb = []
for i in range(m):
    tb += [[int(x) for x in input().split()]]

res = 0
for v in itertools.permutations(range(n)):
    score = 0
    for t in tb:
        it1, it2, sc = t[0], t[1], t[2]
        for vv in v:
            if vv == it1:
                score += sc
                break
            elif vv == it2:
                break
    res = max(score, res)

print(res)
0