結果

問題 No.90 品物の並び替え
ユーザー nbisconbisco
提出日時 2016-08-30 23:19:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 452 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 17,824 KB
最終ジャッジ日時 2024-04-26 21:23:11
合計ジャッジ時間 9,247 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,624 KB
testcase_01 AC 674 ms
10,624 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 65 ms
10,624 KB
testcase_04 AC 93 ms
10,752 KB
testcase_05 AC 767 ms
10,752 KB
testcase_06 AC 521 ms
10,624 KB
testcase_07 AC 38 ms
10,624 KB
testcase_08 AC 31 ms
10,624 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N, M = [int(i) for i in input().strip().split(" ")]
scores = []
for i in range(M):
    scores.append([int(j) for j in input().strip().split(" ")])

max_score = 0
for p in itertools.permutations([i for i in range(N)]):
    tmp_score = 0
    for score in scores:
        if p.index(score[0]) < p.index(score[1]):
            tmp_score += score[2]
    if max_score < tmp_score:
        max_score = tmp_score

print(max_score)
           
0